Using Console
Using CLI
az login
.Step 3: Check if the Azure VM has the Microsoft Monitoring Agent installed using the Azure CLI command az vm extension list --resource-group <resource-group-name> --vm-name <vm-name> --query "[].{Name:name, ProvisioningState:provisioningState}" --output table
. If the ProvisioningState is not ‘Succeeded’ for the Microsoft Monitoring Agent, then it is not provisioned.Step 4: To remediate this, you can install the Microsoft Monitoring Agent on the Azure VM using the Azure CLI command az vm extension set --resource-group <resource-group-name> --vm-name <vm-name> --name MicrosoftMonitoringAgent --publisher Microsoft.Azure.Monitoring.AzureMonitoringAgent --version 1.0 --protected-settings '{"workspaceKey": "<workspace-key>"}' --settings '{"workspaceId": "<workspace-id>"}'
.Note: Replace <resource-group-name>
, <vm-name>
, <workspace-key>
and <workspace-id>
with the appropriate values for your environment.Step 5: After executing the above command, wait for a few minutes for the extension installation to complete. You can check the status of the extension installation using the Azure CLI command az vm extension list --resource-group <resource-group-name> --vm-name <vm-name> --query "[].{Name:name, ProvisioningState:provisioningState}" --output table
. Once the ProvisioningState is ‘Succeeded’, the Microsoft Monitoring Agent is provisioned.Step 6: You can now monitor the Azure VM using Azure Monitor.These steps should help you remediate the misconfiguration of Monitoring Agent not being provisioned in Azure using Azure CLI.Using Python