More Info:
Ensure that Performance Diagnostics feature is enabled for your Microsoft Azure virtual machine instances in order to help mitigate VM performance issues. Performance Diagnostics installs a VM extension that runs a self-help diagnostics tool named PerfInsights, available for both Windows and Linux operating systems. PerfInsights can collect and analyze diagnostic information such as virtual machine hardware and storage configuration, various log files, OS information, PCI device information, guest OS log files, configuration files, information about running processes, virtual machine instance disk, memory, CPU usage, and networking information.Risk Level
MediumAddress
SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- Reserve Bank of India (RBI) Master Direction – Information Technology Framework
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- 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
ComputeManagementClientobject 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.Using Terraform
Using Terraform
REPLACE_WITH_VM_NAMEwith the existing VM name.REPLACE_WITH_ADMIN_USERNAME/REPLACE_WITH_ADMIN_PASSWORDwith appropriate credentials (or useadmin_ssh_keyfor Linux and the correspondingazurerm_linux_virtual_machineplus this sameazurerm_virtual_machine_extensionattached to that VM’s ID).
terraform plan should show a new azurerm_virtual_machine_extension.performance_diagnostics resource to be created, with no changes requiring replacement of the existing virtual machine.
