How to use a different version of DSC modules available in Azure DSC Module Gallery


The Azure team updates the Azure DSC module gallery regularly and there is also mechanism provided in the Azure Automation account to update the modules when new version are available. But how do you use a different or an older version of these modules? Recently I came across a scenario where I needed to use an older version of DSC module for SharePoint farm build as all the testing had been done against a specific version. The modules available in the gallery had already advanced to the latest SharePointDSC module. Following is a guide on how to use specific version of DSC modules. These steps also apply if you built your own module, and wanted to import it into your Automation account.

Deploy directly from the PowerShell Gallery

  1. Go to https://www.powershellgallery.com/ and search for the module you are require - in my case it was SharePointDSC.
  2. Navigate to the bottom of the page where it shows all the previous releases
  3. Click "Deploy to Azure Automation". This will redirect you to the Azure portal, and once you successfully login, it will navigate you to Import Module Blade.
  4. Here you can either select an existing automation account to import the module to, or create a new one.

Manual Import

To manually import the module

  1. Save the module to a local directory by running save Save-Module Commandlet
    Save-Module -Name SharePointDSC -Path [Path] -RequiredVersion 2.1.0.0
  2. Navigate it to the path where you saved the module, and open the <moduleName>\<Version> folder. The <version> folder contains the ps1 file with module definition.
  3. Zip all the contents of this folder and name the zip file same as the name of the ps1 file. So in my case, the file is called SharePointDSC.zip
    Here is some guidance on naming module files. This also applies if you were building a custom module https://azure.microsoft.com/en-us/blog/authoring-integration-modules-for-azure-automation/
  4. Once you have a zip file, Login into the azure portal and navigate to the Automation account, and then to the DSC modules blade
  5. Click "Add a Module" and upload the zip file. Once the importing of the module is finished, the module is ready for use.
Comments (0)

Skip to main content