Skip navigation
Check DSC Execution Status in Azure VMs

Check DSC Execution Status in Azure VMs

Learn how to check DSC configuration in an Azure VM.

Q. How can I check the status of DSC execution within an Azure VM via the Azure VM agent?

A. The Azure VM Agent enables many configuration extensions to be utilized with Azure workloads, including the custom script resource extension that enables PowerShell DSC configurations to be applied either at time of VM creation or at a later time via the Set-AzureVMDscExtension cmdlet. Below is an example of how to create a DSC package for use in Azure that will be uploaded to the default storage account then applied.

Publish-AzureVMDscConfiguration -ConfigurationPath ‘D:\temp\DSC_IISConfig.ps1' -Verbose -Force

Set-AzureVMDscExtension -VM $VM -ConfigurationArchive 'DSC_IISConfig.ps1.zip' `
-ConfigurationName 'IIS Config' -Verbose -Force | Update-AzureVM

The easiest way to check on the last DSC action in an Azure VM via the extension is by examining the status of the associated handler. In the example below, I view the status during the DSC application and once complete.

PS C:\> $mySvc = 'savilltecheastuscs'
PS C:\> $VMName = 'dsctest'
PS C:\> ((Get-AzureVM -ServiceName $mySvc -Name $VMName).ResourceExtensionStatusList | Where-Object { $_.HandlerName -eq 'Microsoft.Compute.CustomScriptExtension' }).ExtensionSettingStatus.Status
Transitioning

PS C:\> ((Get-AzureVM -ServiceName $mySvc -Name $VMName).ResourceExtensionStatusList | Where-Object { $_.HandlerName -eq 'Microsoft.Compute.CustomScriptExtension' }).ExtensionSettingStatus.Status
Success

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish