Install Azure PowerShell on Windows with PowerShellGet

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

This article explains the steps to install the Azure PowerShell modules for PowerShell 5.x for Windows using PowerShellGet. PowerShellGet and module management is the preferred way to install Azure PowerShell but if you would rather install with the Web Platform Installer or MSI package, see Other installation methods.

The Azure classic deployment model is not supported by this version of Azure PowerShell. For support for classic deployments, follow the instructions in Install the Azure PowerShell Service Management module.

Important

The AzureRM module is not supported for macOS or Linux. To use Azure PowerShell cmdlets on these platforms, Install the Az module.

Requirements

Starting with Azure PowerShell version 6.0, Azure PowerShell requires PowerShell version 5.0. To check the version of PowerShell running on your machine, run the following command:

$PSVersionTable.PSVersion

If you have an outdated version, see Upgrading existing Windows PowerShell.

Important

The module described in this document, AzureRM, uses .NET Framework. This makes it incompatible with PowerShell 6.0, which uses .NET Core. If you are using PowerShell 6.0, follow the installation instructions for macOS and Linux.

Install the Azure PowerShell module

You need elevated privileges to install modules from the PowerShell Gallery. To install Azure PowerShell, run the following command in an elevated session:

Install-Module -Name AzureRM -AllowClobber

Note

If you have a version older than 2.8.5.201 of NuGet, you are prompted to download and install the latest version of NuGet.

By default, the PowerShell gallery isn't configured as a trusted repository for PowerShellGet. The first time you use the PSGallery you see the following prompt:

Untrusted repository

You are installing the modules from an untrusted repository. If you trust this repository, change
its InstallationPolicy value by running the Set-PSRepository cmdlet.

Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Answer Yes or Yes to All to continue with the installation.

The AzureRM module is a rollup module for the Azure PowerShell cmdlets. Installing it downloads all of the available Azure Resource Manager modules, and makes their cmdlets available for use.

Sign in

To start working with Azure PowerShell, sign in with your Azure credentials.

# Connect to Azure with an interactive dialog for sign-in
Connect-AzureRmAccount

Note

If you've disabled module autoloading, you need to manually import the module with Import-Module AzureRM. Because of the way the module is structured, this can take a few seconds.

You'll need to repeat these steps for every new PowerShell session you start. To learn how to persist your Azure sign-in across PowerShell sessions, see Persist user credentials across PowerShell sessions.

Update the Azure PowerShell module

You can update your Azure PowerShell installation by running Update-Module. This command does not uninstall earlier versions.

Update-Module -Name AzureRM

If you want to remove older versions of Azure PowerShell from your system, see Uninstall the Azure PowerShell module.

Use multiple versions of Azure PowerShell

It's possible to install more than one version of Azure PowerShell. To check if you have multiple versions of Azure PowerShell installed, use the following command:

Get-InstalledModule -Name AzureRM -AllVersions |
  Select-Object -Property Name, Version

To remove a version of Azure PowerShell, see Uninstall the Azure PowerShell module.

You might need more than one version if you work with on-premises Azure Stack resources, run an older version of Windows, or use the Azure classic deployment model. To install an older version, provide the -RequiredVersion argument when installing.

# Install version 2.3.0 of Azure PowerShell
Install-Module -Name AzureRM -RequiredVersion 2.3.0

When loading the Azure PowerShell module the latest version is loaded by default. To load a different version, specify the RequiredVersion parameter.

# Load version 2.3.0 of Azure PowerShell
Import-Module -Name AzureRM -RequiredVersion 2.3.0

Provide feedback

If you find a bug when using Azure Powershell, file an issue on GitHub. To provide feedback from the command line, use the Send-Feedback cmdlet.

Next Steps

To get started using Azure PowerShell, see Get Started with Azure PowerShell to learn more about the module and its features.