How to update Azure PowerShell modules in Azure Automation

To update the Azure modules in your Automation Account you need to use the Update Azure modules runbook, which is available as open source. To start using the Update-AutomationAzureModulesForAccount runbook to update your Azure modules, download it from the Update Azure modules runbook repository on GitHub. You can then import it into your Automation Account or run it as a script. To learn how to import a runbook in your Automation Account, see Import a runbook.

The most common AzureRM PowerShell modules are provided by default in each Automation account. The Azure team updates the Azure modules regularly, therefore to keep up to date you will want to use the Update-AutomationAzureModulesForAccount runbook to update the modules in your Automation accounts.

Because modules are updated regularly by the product group, changes can occur with the included cmdlets. This action may negatively impact your runbooks depending on the type of change, such as renaming a parameter or deprecating a cmdlet entirely.

To avoid impacting your runbooks and the processes they automate, test and validate before proceeding. If you don't have a dedicated Automation account intended for this purpose, consider creating one so that you can test many different scenarios during the development of your runbooks. This testing should include iterative changes such as updating the PowerShell modules.

If you develop your scripts locally, it's recommended to have the same module versions locally that you have in your Automation Account when testing to ensure you'll receive the same results. After the results are validated and you've applied any changes required, you can move the changes to production.


A new Automation account might not contain the latest modules.


You will not be able to delete global modules - modules that Automation provides out of the box.


The following are some considerations to take into account when using this process to update your Azure Modules:

  • This runbook supports updating the Azure and AzureRm modules by default. This runbook supports updating the Az modules as well. Review the Update Azure modules runbook README for more information on updating Az modules with this runbook. There are additional important factors that you need to take into account when using the Az modules in your Automation Account, to learn more, see Using Az modules in your Automation Account.

  • Before starting this runbook, make sure your Automation account has an Azure Run As account credential created.

  • You can use this code as a regular PowerShell script instead of a runbook: just sign in to Azure using the Connect-AzureRmAccount command first, then pass -Login $false to the script.

  • To use this runbook on the sovereign clouds, use the AzureRmEnvironment parameter to pass the correct environment to the runbook. Acceptable values are AzureCloud, AzureChinaCloud, AzureGermanCloud, and AzureUSGovernment. These values can be retrieved from using Get-AzureRmEnvironment | select Name. If you don't pass a value to this parameter, the runbook will default to the Azure public cloud AzureCloud

  • If you want to use a specific Azure PowerShell module version instead of the latest available on the PowerShell Gallery, pass these versions to the optional ModuleVersionOverrides parameter of the Update-AutomationAzureModulesForAccount runbook. For examples, see the Update-AutomationAzureModulesForAccount.ps1 runbook. Azure PowerShell modules that aren't mentioned in the ModuleVersionOverrides parameter are updated with the latest module versions on the PowerShell Gallery. If you pass nothing to the ModuleVersionOverrides parameter, all modules are updated with the latest module versions on the PowerShell Gallery. This behavior is the same as the Update Azure Modules button.

Next steps

Visit the open source Update Azure modules runbook to learn more about it.