你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Install Azure PowerShell on macOS

This article explains how to install the Az PowerShell module from the PowerShell Gallery on macOS.

The Az PowerShell module is a rollup module. Installing it downloads the generally available Az PowerShell modules and makes their cmdlets available for use.

Prerequisites

Installation

Open the Terminal or other shell host application and run pwsh to start PowerShell.

Use the Install-Module cmdlet to install the Az PowerShell module:

Install-Module -Name Az -Repository PSGallery -Force

Update the Azure PowerShell module

Use the Update-Module cmdlet to update to the latest version of the Az PowerShell module.

Update-Module -Name Az -Force

Updating the Az PowerShell module using Update-Module doesn't remove old versions of the Az PowerShell module from your system.

Uninstallation

To remove the Az PowerShell module from your system, see Uninstall the Azure PowerShell module.

Sign in

To start managing your Azure resources with the Az PowerShell module, launch a PowerShell session and run Connect-AzAccount to sign in to Azure:

Connect-AzAccount

Use your Azure account login credentials to log into the browser window that opens.

You'll need to repeat this step for every new PowerShell session you start. To learn how to persist your Azure sign-in across PowerShell sessions, see Azure PowerShell context objects.

Troubleshooting

For solutions to common installation issues with the Az PowerShell module, see Troubleshoot installation problems with the Az PowerShell module.

Provide feedback

To file an issue about the Az PowerShell module, see: file an issue on GitHub.

To provide feedback from within a PowerShell session, use the Send-Feedback cmdlet.

Next steps

To learn more about managing your Azure resources with the Az PowerShell module, see Get Started with Azure PowerShell.