Azure Automation DSC: How to register and use Azure Automation DSC

One of the new features of Azure Automation is still somewhat hidden. It needs to be enabled before you see it in the GUI

This blog post gives a quick overview of what is needed to use it.

 

Step 1: Enable the extension in your Azure Account

The command registers the azure automation dsv extension on your account. This shows the DSC Nodes tile in your automation account:

 

image

 

Step 2: Select subscription and default values

Before you can run any command you will need to select your subscription.

additionally each of the command needs 2 values ResourceGroupName and AutomationAccountName To keep the code easy to read, you can use the $PSDefaultParameter values to save the values

 

Step 3: Write configuration

A DSC configuration needs to be created. This example is very simple and will end up having the configuraiton name “psug.webserver”

 

Create and save this file as PSIUG.ps1

NB! it is important that the filename is the same as configuration name.

 

Step 4: Import and Compile configuration

Next step is to import and conpile the configuration for your DSC node.

the import will upload your file to Azure automation DSC (will not be shown in any gui yet) after the import, the configuration needs to be compiled to be used on your machines. This will generate a configration called configurationName.NodeName in this example psug.webserver

 

Step 5: Create or Register machine / node

this code snippet contains a few example to check the node and unregister

To add the extension to an existing machine using Azure Preview Portal:

1. Open Machine overview

2. Click “all Settings”

3. Select “extensions”

4. Click Add

image

5. Select “Azure Automation DSC”

6. Click Create

7. Set Registration URL and Key. These can be found in the dashboard of the automation account as seen in this picture:

 

image

8. Set Trigger intervals and configuration mode.

In the example we use “applyandautocorrect” whcih will keep the machine compliant in the future

Read more about the options available here:

https://technet.microsoft.com/en-us/library/dn249922.aspx

image 

9. Click OK

 

You can use the same technique when creating a new Azure Machine.

It can also be created from PowerShell using the example from the documentation.

 

Documentation:

https://azure.microsoft.com/en-us/documentation/articles/automation-dsc-overview/

 

Other commands

this code snippet contains a few example to check the node and unregister

By | 2015-06-22T15:48:19+00:00 June 22nd, 2015|Powershell, Scripting & Development|2 Comments

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at http://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack

Training:

  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops

2 Comments

  1. Andrea Rizzioli September 30, 2015 at 14:56 - Reply

    Hi,
    Is there a cmdlet to install the Azure Automation DSC Extension on a server created in the Azure Resource Manager api (not a classic server)?
    Thanks.

    • Rohin February 11, 2016 at 6:04 - Reply

      Hi Andrea. I have the same problem. I figured out this much:

      Set-AzureRmVMDscExtension -ResourceGroupName “resourcegrpname” -VMName “vmname” -ArchiveBlobName “PSUG.ps1.zip” -ArchiveStorageAccountName “storageaccountname” -ConfigurationName “PSUG” -Version “2.8” -Location “JapanEast”

      Except, provisioning failed =( and I am stuck with what to do from here…

      Get-AzureRmVMDscExtensionStatus returns:

      ResourceGroupName : xxxx
      VmName : xxxx
      Version : 2.8
      Status : Provisioning failed
      StatusCode : ProvisioningState/failed/8
      Timestamp : 11/02/2016 4:40:39 AM
      StatusMessage : DSC Configuration completed with error(s).
      DscConfigurationLog : {Perform operation ‘Invoke CimMethod’ with following parameters, ”methodName’
      = SendConfigurationApply,’className’ =
      MSFT_DSCLocalConfigurationManager,’namespaceName’ =
      root/Microsoft/Windows/DesiredStateConfiguration’., The WinRM client cannot
      process the request. If the authentication scheme is different from Kerberos,
      or if the client computer is not joined to a domain, then HTTPS transport must
      be used or the destination machine must be added to the TrustedHosts
      configuration setting. Use winrm.cmd to configure TrustedHosts. Note that
      computers in the TrustedHosts list might not be authenticated. You can get
      more information about that by running the following command: winrm help
      config., Operation ‘Invoke CimMethod’ complete., Time taken for configuration
      job to complete is 2.906 seconds}

Leave A Comment