Check DSC Execution Status in Azure VMs

Learn how to check DSC configuration in an Azure VM.

John Savill

February 28, 2015

1 Min Read
Check DSC Execution Status in Azure VMs

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:tempDSC_IISConfig.ps1' -Verbose -ForceSet-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.StatusTransitioningPS C:> ((Get-AzureVM -ServiceName $mySvc -Name $VMName).ResourceExtensionStatusList | Where-Object { $_.HandlerName -eq 'Microsoft.Compute.CustomScriptExtension' }).ExtensionSettingStatus.StatusSuccess

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like