如何在 PowerShell 中使用 Azure CLI 连接到 Azure 订阅?
powershellmicrosoft technologiessoftware & coding更新于 2026/2/12 23:22:17
要使用 Azure CLI 连接到特定的 Azure 订阅,我们需要使用 "Az account set" 命令,但在使用此命令之前,请确保您已使用 "az login" 帐户连接到 Azure 云。
az account set --subscription 'subscription name or id'
您也可以使用 -s 代替 --subscription.
az account set -s '订阅名称或 ID'
要检查订阅是否设置正确,请使用以下命令。
PS C:\> az account show -otable

