Triage and Remediation
Remediation
Using Console
Using Console
To remediate the issue of Monitoring Agent not being provisioned in Azure, follow these steps:
- Log in to the Azure portal (https://portal.azure.com/).
- Navigate to the virtual machine (VM) that needs to be remediated.
- Click on the “Extensions” tab in the left-hand menu.
- Click on the “Add” button to add a new extension.
- In the “Add extension” blade, select the “Microsoft Monitoring Agent” extension.
- Click on the “Create” button to create the extension.
- In the “Monitoring Agent” blade, configure the following settings:
- Workspace ID: Enter the ID of the Log Analytics workspace where you want to send the VM’s monitoring data.
- Workspace Key: Enter the key for the Log Analytics workspace.
- Azure Environment: Select the Azure environment where the VM is located (e.g., AzureGlobalCloud).
- Click on the “OK” button to save the settings.
- Wait for the extension to be installed and configured on the VM. This may take several minutes.
- Once the extension is installed and configured, verify that the Monitoring Agent is running on the VM by checking the status of the “Microsoft Monitoring Agent” service in the Windows Services console.
Using CLI
Using CLI
To remediate the misconfiguration of Monitoring Agent not being provisioned in Azure using Azure CLI, you can follow the below steps:Step 1: Install the Azure CLI on your local machine if you haven’t already.Step 2: Login to your Azure account using the Azure CLI command
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
Using Python
To remediate the “Monitoring Agent is not provisioned” misconfiguration in Azure using Python, you can use the Azure Python SDK. Here are the steps to remediate the issue:Note: Replace the placeholders with your own values.
- Install the Azure Python SDK using pip:
- Import the necessary modules:
- Create a Service Principal and retrieve the credentials:
- Create a MonitorManagementClient object:
- Check if the Monitoring Agent is provisioned:
- If the Monitoring Agent is not provisioned, you can remediate the issue by installing the agent extension: