Enable Diagnostic Settings on Virtual Machine after Already Provisioned on Azure
Powershell Gallery |Diagnostics | Azure | Microsoft | Operations | Az.Compute
This article will quickly demonstrate how to add the diagnostic settings on a Virtual Machine that has already been provisioned. This might be a need if a Snapshot was utilized to create a Virtual Machine and the Snapshot did not have the diagnostic setting enabled. This process is very quick and simple.
Step 1. Install the Az.Compute Module from the Powershell Gallery
The particular command we are using is Set-AzVMDiagnosticsExtension and it is a part of the Az.compute module. So let's make sure it's installed.
Install-Module -Name Az.Compute -Force
Step 2. Setup a Storage Account (Optional)
If a storage account is already created then you can use it. If not create a Storage Account in Azure and copy the Access Key.
Step 3. Setup the Diagnostic File
Create a file called “diagnostic-settings.json” and add the following:
{
"PublicConfig": {
"WadCfg": {…