How To Enable Azure Diagnostics For VMs Using PowerShell Script?
1. Install PowerShell ISE, our preferred PowerShell IDE (standard PowerShell works fine as well).
2. Make sure Azure RemoteManagement (Azure RM) modules are installed.
3. Download the script attached to this article
4. Open it with PowerShell.
5. Follow instructions on the screen to run the script - you will have to log in with Owner role credentials in order to run it successfully.
Or, you can run the script from PowerShell command line:
- Enable diagnostics for all VMs :
- Enable diagnostics for one VM (must provide resource group name) :
& '.\enable-diagnostics.ps1' -targetRsgName “mygroupname” -targetVmName “vmname”
Specify the name of the Azure subscription ID to run the script against. If not specified, it will be rUn against your default subscription.
Many of your Azure accounts contain a lot of resources, and Diagnostics On are required for Unigma to gather metrics and generate alerts. Using this script, you can enable Diagnostics across one, many or all of your resources.
Please follow these steps.