Passer au contenu principal

New additions to the Azure VM PowerShell DSC Extension

Publié le 19 mars, 2015

Senior Program Manager, Microsoft Azure
The Azure PowerShell Desired State Configuration (DSC) Extension team has announced some exciting new additions to provide a seamless experience for using DSC on Azure Windows VMs. One of them is a new cmdlet to retrieve DSC configuration status from the Azure Virtual Machine. If you haven't taken a look at using DSC on Azure, please check out the blog post here. In a nutshell, the Azure DSC Extension allows you to upload and apply DSC configuration to a remote Azure VM using PowerShell or Azure Portal . This enables you to leverage the power of DSC in Azure without requiring you to configure any extra ports on the VM. As with any other VM Extension, it can be added to the VM anytime during its lifecycle. If you are new to DSC or are already using DSC on-premises and would like to extend it to Azure, here is the typical workflow:
1. Select the DSC Resource:   Use built-in DSC resource or write custom resources to perform configuration actions on the VM. 2. Publish the Resource: Publish the DSC resource to Azure Storage using the Publish- AzureVMDscConfiguration cmdlet. 3. Apply DSC Configuration to the VM: Apply the DSC configuration to the virtual machine either from PowerShell (Set-AzureVMDscExtension) or Azure Portal. 4. Monitor Status: Monitor the DSC configuration status. Detailed steps for all of the above can be found in the MSDN Documentation Page.
Here is how the new cmdlet, Get-AzureVMDscExtensionStatus retrieves the DSC configuration status from the VM. The configuration status was always available, this cmdlet makes it easy to retrieve the status in a single step.
PS C:\dsc-azure-ext\tests\EndToEnd> $status = Get-AzureVMDscExtensionStatus -ServiceName example-0 -Name example-0
PS C:\dsc-azure-ext\tests\EndToEnd> $status

ServiceName         : example-0
Name                : example-0
Status              : Transitioning
StatusCode          : 9
Timestamp           : 2/26/2015 4:50:10 AM
StatusMessage       : DSC configuration is in progress.
DscConfigurationLog : {Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = 
                      SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = 
                      root/Microsoft/Windows/DesiredStateConfiguration'., An LCM method call arrived from computer 
                      EXAMPLE-0 with user sid S-1-5-18., An LCM method call arrived from computer EXAMPLE-0 with user sid 
                      S-1-5-18., [EXAMPLE-0]: LCM:  [ Start  Set      ]...}
We hope you find this new addition helpful! Please send us feedback on what feature enhancements you would like to see to make it easy to run PowerShell DSC on Azure.