Down the rabbit hole – Activity log preview vs. Global Availability

Doing a lot lately with extracting the activity logs, metric and diagnostic logs from Azure. I noticed the change made in December when going from “Export activity log” to the Diagnostic settings way, used for enablement of sending your diagnostic and metrics to an event-hub.

The old configuration is only visible when you use the “Looking for the legacy experience?” bar. This is a minor inconvenience as I do most of the configurations through the Azure CLI. For testing, I Created a new PocActivityLog in the UI.

When looking with the Azure CLI I did not see any configured logs that used the new portal, only the old ones like; “mylogprofile”.

Browsing through the I could not find it either and only see the old “mylogprofile”.

Looking in the official documentation no solution can be found because it points you to the statements already used. So how to find and use the new exports. After trying some different things it occurred to me that the way it is working now is the same way as the diagnostic settings in any other resource. By querying this with the subscription as a resource I found my newly added settings “PocActivityLog”.

An additional caveat is that if you want to retrieve the possible categories for a resource you would normally do this through az monitor diagnostic-settings categories list --resource /subscriptions/XXXX-XXXX-XXXX-XXXX-XXXX. This doesn’t work or never has worked. To get the categories for resources you are better off using the REST-API. This works only for resources and not for subscriptions. Running GET{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories?api-version=2017-05-01-preview for subscriptions resolves into a status 400 bad request , to get the categories for subscriptions you need to:

To retrieve this from the REST-API you can use GET To get a IEnumerable<LocalizableString>. This is all a bit confusing and needs some alignment to make it more sensible. For now, I hope this little article saves somebody some time.


You may also like...

Leave a Reply