Triage and Remediation
Remediation
Using Console
Using Console
To enable Performance Diagnostics for Azure Virtual Machines, you can follow the below steps:
- Log in to the Azure portal (https://portal.azure.com/).
- In the left-hand menu, click on “Virtual machines”.
- Select the virtual machine that you want to enable Performance Diagnostics for.
- In the virtual machine menu, click on “Diagnostic settings” under the Monitoring section.
- Click on the “Add diagnostic setting” button.
- In the “Add diagnostic setting” blade, give a name to the setting.
- Under “Metrics”, select the “Performance counters” option.
- Click on the “Add +” button to add a new performance counter.
- In the “Add performance counter” blade, select the desired counter from the list.
- Click on the “Add” button to add the performance counter.
- Under “Logs”, select the “Performance counters” option.
- Click on the “Add +” button to add a new performance counter.
- In the “Add performance counter” blade, select the desired counter from the list.
- Click on the “Add” button to add the performance counter.
- Click on the “Save” button to save the diagnostic setting.
Using CLI
Using CLI
To enable performance diagnostics for Azure Virtual Machines using Azure CLI, follow these steps:
- Open the Azure CLI command prompt.
-
Set the subscription that contains the virtual machine. Use the following command to set the subscription:
-
Enable performance diagnostics for the virtual machine. Use the following command to enable performance diagnostics:
Replace the following values in the command:
<resource-group-name>
: The name of the resource group that contains the virtual machine.<vm-name>
: The name of the virtual machine.<sink-name>
: The name of the sink that will receive the performance data.<storage-account-uri>
: The URI of the storage account that will receive the performance data.<sas-token>
: The SAS token for the storage account.<category>
: The category of the performance counter.<counter-specifier>
: The name of the performance counter.<sampling-interval>
: The sampling interval for the performance counter.<unit>
: The unit of the performance counter.
-
Verify that performance diagnostics have been enabled for the virtual machine. Use the following command to verify the settings:
Replace
<resource-group-name>
and<vm-name>
with the actual resource group and virtual machine names. The command will return the default configuration for the virtual machine. Verify that the performance counters are included in the configuration.
Using Python
Using Python
To enable Performance Diagnostics for Azure Virtual Machines using Python, you can use the Azure SDK for Python. Here are the step-by-step instructions:Replace
- Install the Azure SDK for Python. You can install it using pip by running the following command:
- Authenticate with Azure. You can authenticate using a service principal or user credentials. Here’s an example of how to authenticate using a service principal:
- Create a
ComputeManagementClient
object using the authenticated credentials:
- Get the virtual machine object:
- Enable Performance Diagnostics for the virtual machine:
<your tenant id>
, <your client id>
, <your client secret>
, <your subscription id>
, <your resource group name>
, <your virtual machine name>
, and <your storage account uri>
with the appropriate values.These steps will enable Performance Diagnostics for the specified Azure Virtual Machine.