Install Azure PowerShell on macOS or Linux
For non-Windows platforms, it's possible to run Azure PowerShell in PowerShell Core v6. This version of PowerShell is built for use on any platform that supports .NET Core. To work with these platforms, there's a .NET Standard version of Azure PowerShell available.
At this time, Azure PowerShell for .NET Standard is still in beta. If you have problems or discover bugs, please file an issue on GitHub.
Install PowerShell Core
The installation instructions for PowerShell Core are different for macOS and most Linux distributions. Detailed instructions can be found in the following articles:
Install Azure PowerShell for .NET Standard
AzureRM module detailed in other articles does not work with PowerShell Core.
You must install the
Az module to get Azure PowerShell functionality in PowerShell Core.
PowerShell Core comes with the PowerShellGet module already installed. Start PowerShell with the command:
To install Azure PowerShell, run the following command:
If you encounter a permissions error when attempting to install the module, you may need to run PowerShell in superuser mode to install modules.
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.
For compatibility with the existing
AzureRM module, the new
Az module has the ability to create backwards compatible
aliases for the
AzureRM cmdlets. Before using the module for the first time, set up these aliases with the following command:
# Import the module into the PowerShell session Import-Module Az # Enable AzureRM aliases for the user Enable-AzureRmAlias -Scope CurrentUser
This sets up aliases for the current user only. Check the cmdlet help for other values that can be provided to
set up the aliases.
If you encounter an error about a path location, make sure that it exists on your local system. For the
this error can be resolved by running the following command in
mkdir -p $HOME/.config/powershell
To start working with Azure PowerShell, you need to load
Az into your PowerShell session
with the Import-Module cmdlet, and then sign in
with your Azure credentials. Importing a module does not require elevated privileges.
# Import the module into the PowerShell session Import-Module Az # 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
Az module requires
setting up a PowerShell profile, which you can learn about in About Profiles.
On macOS and Linux, you should work with your profile through the
$Profile environment variable. To learn how to persist your Azure sign-in across sessions,
see Persist user credentials across PowerShell sessions.
For more information about using Azure PowerShell, see the Get started with Azure PowerShell article.