I have an Azure Monitor Diagnostic Settings object on which I am trying to set the logAnalyticsDestinationType
property. But it does not stick:
~$ id=/subscriptions/4...d/resourceGroups/xyz/providers/Microsoft.ContainerService/managedClusters/abc
~$ az monitor diagnostic-settings show --resource $id -n loganalytics-diagnostics --query logAnalyticsDestinationType
~$ az monitor diagnostic-settings update --resource $id -n loganalytics-diagnostics --set logAnalyticsDestinationType=AzureDiagnostics --query logAnalyticsDestinationType
"AzureDiagnostics"
~$ az monitor diagnostic-settings show --resource $id -n loganalytics-diagnostics --query logAnalyticsDestinationType
~$
Without delving into much details on why I want to set it, is it possible to set it at all?
2
Answers
It seems that there’s currently an open issue with Azure regarding this topic:
It seems to be that there’s an erratic behaviour where the
logAnalyticsDestinationType
property is not being set and it is returing as either:null
AzureDiagnostics
Some responses on the first issue suggests that if you delete the Monitoring diagnostics settings and re-create it "fixes" in a non consistent way.
Although, I’ve had to delete it from the Portal UI and then re-create it through Terraform, and the
logAnalyticsDestinationType
was still set to null.I tried to update the logAnalyticsDestinationType. of azure monitor diagnostic settings with the Azure CLI command and was able to update it successfully like below:-
Azure CLI command:-
Output:-
Where resource is the resource ID of the Azure resource that you want to update the diagnostic settings of, the Resource Id can be found in the Properties tab of your Azure resource, and -n is the name of the diagnostic settings you want to update and set value is used to set the new property of logAnalyticsDestinationType.
Make sure you use the correct resource ID in the $id variable, add the correct -n name and –set value to change the logAnalyticsDestinationType.
Reference:-
az monitor diagnostic-settings subscription | Microsoft Learn