Adding and using DSC For Linux Azure Automation DSC Gallery Item to Azure Stack TP2

In the previous post we added the DSC For Linux VM Extension Gallery item to Azure Stack and used it during deployments with a precompiled mof. In this post we will create another where the target is to onboard the Linux node into Azure Automation DSC.

In this series:

Adding and using….

VM Extension Gallery Item

In this blog post, we’ll create a Gallery item to expose the DSC For Linux VM extension in regard to the second use case (Register). As most of this was already covered in the previous post, we’ll dive right in. You can just copy your previous files into a new folder and start from there.

Artifact structure

The artifact has the following structure and files:


We again have a root folder and 3 sub folders (DeploymentTemplates, icons and strings).

Root level documents folder

At the root level we have 2 json files:

  • Manifest.json
  • UIDefinition.json


The manifest for this Gallery Items differs from the previous one only for its name key which is now “DSCForLinuxAADSC-arm”.


The UIDefinition.json is exactly the same. No change here.

DeploymentTemplates folder

The DeploymentTemplates folder contains two json files which do differ a bit:

  • CreateUiDefinition.json
  • MainTemplate.json


CreateUiDefinition is tuned to the register use case.

In this case I have defined 2elements:

  • RegistrationUrl
  • RegistrationKey
RegistrationUrl and RegistrationKey

The type of these elements is “Microsoft.Common.TextBox”, which is generated by the Portal as a free text field.


You can see the labels showing up and the tooltips when clicked / hovered over, will show the info we provided.



At the end of the CreateUiDefinition.json, outputs are specified. These outputs are used to send as values for the parameters of MainTemplate.json which is used by the Portal to add the VM Extension to an already deployed VM or merge into the overall JSON generated for a VM from scratch deployment.


MainTemplate again, is basically a JSON template you would create yourself to add the DSC For Linux VM Extension to an already deployed VM.

I created parameters which correspond with the outputs from the CreateUiDefinition.json and mapped those to the resource properties where applicable. As you can see this template only has the public settings Mode which is hardcoded to Register. Besided the public settings, protectedSettings are defined in this case for the registration url and key.


I just kept the same icons from the previous blog.

Large.png 115 x 115 px  bg_as_05crpaddon_04
Medium.png 90 x 90 px  bg_as_05crpaddon_05
Small.png 40 x 40 px  bg_as_05crpaddon_06
Wide.png 255 x 115 px  bg_as_05crpaddon_07
Screenshot1.png 533 x 324 px  bg_as_05crpaddon_08


The strings from strings\resources.resjson are used by the manifest file.

Packaging Gallery Item

Let’s move the folder containing the files to the root of C. Now open a command prompt or PowerShell console and navigate to the packager and run: .\AzureGalleryPackageGenerator\AzureGalleryPackager.exe -m C:\ Microsoft.OSTCExtensions.DSCForLinuxAADSC-arm.1.0.0\Manifest.json -o C:\MyMarketPlaceItems

You should now have a marketplace item in azpkg format. If the packager did not work out, you probably have made some sort of typo somewhere or it just doesn’t like the paths you provide. In any case, you can download the azpkg I created here.

Adding the Gallery Item to Azure Stack

We are going to use the same storage account again from the first blog post, if you did not create it, please go back to that one and create it.

Run the following script to add the azpkg to Azure Stack (I assume you already setup the Azure Stack connection in PowerShell).

You should see a message with StatusCode Ok.


Now we login to the portal, wait a bit, refresh a couple of times and eventually we get:


Note, if you made an error somewhere (wrong text or something) and want to re-add the Gallery item. You should remove it first.

Using the Gallery Item

Now we made the Gallery Item available, let’s put it to work. You need the Uri and one of the access keys from your Azure Automation account. Let’s start to create a new VM based on our CentOS 7.2 Gallery Item.

At step 3 select the Extensions blade and then Add Extension.


Now we should see the DSC For Linux VM Extension Gallery Item.


Select it and hit create.


We can now see the fields we made available. Let’s provide it with the Azure Automation Account Uri and key.


Now we have the extension configured, proceed as normal and deploy the VM. Once finished we the node should be onboarded into Azure Automation DSC.



That’s it for this blog series for now. I do have some follow up ideas however, so probably be expanding this series in the near future!

Spread the word. Share this post!