在macOS上安裝 Azure PowerShell

本文說明如何從 macOS 上的 PowerShell 資源庫 安裝 Az PowerShell 模組。

Az PowerShell 模組是匯總模組。 安裝它會下載正式運作的 Az PowerShell 模組,並讓其 Cmdlet 可供使用。

必要條件

  • 安裝支援的PowerShell第7版或更新版本

安裝

開啟終端機或其他殼層主機應用程式,然後執行 pwsh 以啟動PowerShell。

使用 Install-Module Cmdlet 來安裝 Az PowerShell 模組:

Install-Module -Name Az -Repository PSGallery -Force

更新 Azure PowerShell 模組

使用 Update-Module Cmdlet 來更新為最新版的 Az PowerShell 模組。

Update-Module -Name Az -Force

使用 Update-Module 更新 Az PowerShell 模組並不會從您的系統中移除舊版的 Az PowerShell 模組。

解除安裝

若要從系統移除 Az PowerShell 模組,請參閱 卸載 Azure PowerShell 模組

登入

若要開始使用 Az PowerShell 模組管理 Azure 資源,請啟動 PowerShell 會話並執行 Connect-AzAccount 以登入 Azure:

Connect-AzAccount

使用您的 Azure 帳戶登入認證來登入開啟的瀏覽器視窗。

您必須針對您啟動的每個新 PowerShell 工作階段重複此步驟。 若要瞭解如何跨 PowerShell 工作話保存 Azure 登入,請參閱 Azure PowerShell 內容物件

疑難排解

如需 Az PowerShell 模組常見安裝問題的解決方案,請參閱 針對 Az PowerShell 模組的安裝問題進行疑難解答。

提供意見反應

若要提出有關 Az PowerShell 模組的問題,請參閱: 在 GitHub 上提出問題。

若要在 PowerShell 會話內提供意見反應,請使用 Send-Feedback Cmdlet。

下一步

若要深入瞭解如何使用 Az PowerShell 模組管理 Azure 資源,請參閱 開始使用 Azure PowerShell