Az cli - setting diagnostic logs for event hub



This is a script that allows you to setup diagnostic logging for keyvault and event hub. You can easily use it for other stuff as well.

First of all your start off with something simple like this, to enable diagnostic logging for a vault called "myvault". Unless it is a resource Id, then you need to provide resource group info.  (Please note - resource group is the resource group that vault resides)

When it comes to --workspace, ideally it is best to




az monitor diagnostic-settings create -n "lalala"
--resource "myvault" -g "devrgpmtengine"
--resource-type "Microsoft.KeyVault/vaults"
--workspace "mydevworkspace"
--metrics '[{"category": "AllMetrics","enabled": true,"retentionPolicy":
{"enabled": false, "days": 0 }}]'





when it comes to --workspace, it is best to have something that looks like this, full resource path to your workspace. It looks like the figure below.



"/subscriptions/5fb9f7d2-1e23-42ca-9763-52081ba0d2ae/resourcegroups/
sbrgpmtengine/providers/microsoft.operationalinsights/workspaces/
devlgspaceapp"




So how does diagnostic logging works? You need to configure resource to send to "Log Analytics", otherwise, you can wait for ages and nothing comes up.





This is to help illustrate how to call it. Azure Cli docs can be pretty dodgy and sometimes can take a long time to get things working :-



Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm