Get in touch with us!

Azure Automation DSC in 60

Yeah it’s 60 seconds, 60 minutes or perhaps 60 days depending on how good you are. To get started you’ll need this.

A VM in azure Classic or ARM (I use Classic because it’s hardcore and old)
An Azure automation account
A workstation running PowerShell, (I don’t recommend using anything older than WMF 5.0 because you will miss a lot of cool new features. Not that you’ll need them in this demo, but anyway.)

You can add the DSC extension when deploying your VM, but I’m not going to. Because in this scenario we pretend that the VM’s are already deployed.

While you are setting up your VM(‘s) you can save some time by creating an Azure Automation Account. Give it a name, Group, subscription and location and press play.

When the Automation Account is deployed we’ll need to grab some values from it. Navigate to your automation account -> Keys. Here we grab one of the keys and the service URL.

Next step, add the Azure Automation DSC extension. Before we continue I want to apologize for the naming of my VM’s and the way I mix up the screenshots.

Navigate to your VM, Settings -> Extensions. Press Add and choose to create an Azure Automation DSC extension.

Fill in the information from your Azure Automation Account.

I don’t understand the “Request Id”, I tried using a random GUID but that didn’t work so I just typed something.

Note that the configuration of the Azure Automation DSC extension is done by DSC and sometimes it’s a bit slow. So in my demo this might take 58min or something.

By looking in your Azure Automation Account you can see that you have or haven’t any Nodes registered.

So while the extension is being installed you can log into your VM and check which windows features are installed.

Okay, so this is a webserver without IIS and that’s what I want to configure. So the next step is to create a simple DSC file (locally on my administration computer). This post is not about writing DSC so I’m not going to describe how it works. But here is a simple DSC configuration that’s going to ensure that IIS feature is installed on the target VM.

Configuration IIS {
Node "webserver" {
WindowsFeature IIS {
Ensure = "Present"
Name = "Web-Server"
}
}
}

I save the PS1 file to c:testdscUntitled2.ps1, I think a proper naming of your configuration files is crucial. Then I go to my Azure Automation Account and click on the “DSC Configurations” tile, click Add a configuration, select the file, write a description and press OK.

Now when you have your configuration in Azure you’ll need to compile it, like you do if you have a local DSC pull server.

Navigate to your configuration and press “compile”.

You can check the compilation from the portal or by running this command.

Get-AzureRmAutomationDscCompilationJob -ResourceGroupName DSCPull -AutomationAccountName DSCdemo

 

And once again if you don’t have WMF 5.0 and haven’t installed the newest Azure resource manager cmdlets this won’t work.

And by now you probably have your extension installed.

To show you that it’s working you can run the following commands on your VM.

If the configuration of the extension is successful, you will see your azure automation URL listed in the configuration.

Before we add the configuration to the node let’s run a DSC update manually.

update-dscconfiguration -wait -verbose

No configuration, that’s expected.

Now navigate to your node and click on it.

Inside the properties of the node press the “Assign node configuration”-button, select the configuration and press OK.

Wait a sec or two and then run the update command one more time.

This step is so beautiful it made me cry. IIS gets installed and your VM is now managed by Azure Automation DSC!

To find out more check this article and look at the video by Mark Gray and Joe Levy.

https://azure.microsoft.com/sv-se/documentation/articles/automation-dsc-overview/

Submit a Comment

Your email address will not be published. Required fields are marked *