Introduction
Azure PowerShell provides a set of cmdlets that connect to your Azure subscription and manage resources. This guide will walk you through the installation process for various operating systems.
We recommend installing the latest Az module, which is the current generation of Azure PowerShell modules.
Prerequisites
- An Azure account and subscription.
- An internet connection.
- Administrator privileges on your machine (for some installation methods).
Installation Methods
Choose the method that best suits your operating system and preferences.
Recommended: Install the Az Module using PowerShellGet
This is the most common and flexible method, available for Windows, macOS, and Linux.
-
Open PowerShell
Launch PowerShell as an administrator. On Windows, right-click on the PowerShell icon and select "Run as administrator". On macOS and Linux, open your terminal and type
pwsh. -
Install the Az Module
Run the following command to install the latest version of the Az module:
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -ForceIf you're on macOS or Linux, you might need to use
sudo:sudo pwsh -Command "Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force"You may be prompted to install the NuGet provider and to trust the PSGallery repository. Type
Yand press Enter to accept. -
Verify the Installation
Close and reopen PowerShell. Then, run the following command to check if the Az module is loaded:
Get-Module -ListAvailable -Name AzYou should see the Az module listed. To connect to Azure:
Connect-AzAccount
Platform-Specific Considerations
Optional: Installing AzureRM (Legacy)
The AzureRM module is the older generation of Azure PowerShell modules. It is deprecated and will be retired. While it might still be available for existing scripts, we strongly recommend migrating to the Az module for new development and existing deployments.
To install AzureRM (not recommended for new installations):
Install-Module -Name AzureRM -Scope CurrentUser -Repository PSGallery -Force
Warning: Do not install both Az and AzureRM modules in the same PowerShell session, as they can conflict.