Photo by Luke Chesser on Unsplash

Enable Diagnostic Settings on Virtual Machine after Already Provisioned on Azure

Powershell Gallery |Diagnostics | Azure | Microsoft | Operations | Az.Compute

⚗ Kevin Summersill 🔋
4 min readAug 11, 2021

--

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.

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:

--

--

⚗ Kevin Summersill 🔋
⚗ Kevin Summersill 🔋

Written by ⚗ Kevin Summersill 🔋

Enterprise Solution Architect | Certified K8s Administrator/Developer ⚓ | SAFe SPC | Cert Terraform | AWS Solutions Architect | Dev*Ops/GitOps Engineer 🔥