Install Azure PowerShell on Windows with PowerShellGet
This article explains the steps to install the Azure PowerShell modules in a Windows environment 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.
For instructions to install Azure PowerShell on other platforms, see Install and configure Azure PowerShell on macOS and Linux.
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.
After November 2018, there will be no new features or cmdlets added to the
AzureRM will continue to be supported and
receive bugfixes. New features will be provided in the
Az module, which will reach 1.0 at the same time.
Az has a backwards compatibility
AzureRM, and is designed to be easy to switch to. To learn more about this new module and how to upgrade, see:
- Introducing the Azure PowerShell Az module
- Install Azure PowerShell Az module
- Migrate to the new Azure PowerShell Az module
If you have deployments that use the classic deployment model that cannot be converted, you can install the Service Management version of Azure PowerShell. For more information, see Install the Azure PowerShell Service Management module.
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:
If you have an outdated version, see Upgrading existing Windows PowerShell.
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
If you have a version older than 18.104.22.168 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"):
Yes to All to continue with the installation.
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.
To start working with Azure PowerShell, you need to load
AzureRM into your current PowerShell session
with the Import-Module cmdlet, and then sign in
with your Azure credentials.
# Import the module into the PowerShell session Import-Module AzureRM # Connect to Azure with an interactive dialog for sign-in Connect-AzureRmAccount
You'll need to repeat these steps for every new PowerShell session you start. Automatically importing the
AzureRM module requires
setting up a PowerShell profile, which you can learn about in About Profiles.
To learn how to persist your Azure sign-in across 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-Module -Name AzureRM -List | select 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 1.2.9 of Azure PowerShell Install-Module -Name AzureRM -RequiredVersion 1.2.9
When loading the Azure PowerShell module the latest version is loaded by default. To load a different version, provide the
# Load version 1.2.9 of Azure PowerShell Import-Module -Name AzureRM -RequiredVersion 1.2.9
To get started using Azure PowerShell, see Get Started with Azure PowerShell to learn more about the module and its features.