Powershell
無法使用 Powershell 連接到正確的 Azure 訂閱
我在 Azure 上有很多租戶,我使用 Powershell 來管理它們。
我正在連接我的帳戶:
Login-AzureRmConnect Account SubscriptionName TenantId Environment ------- ---------------- -------- ----------- XXX@XXXX.XXX Microsoft Partner Network XXXXX-XXXX-XXXX-XXXX-XXXX AzureCloud
當我想用有效的 SubscriptionID 更改訂閱時,我有這個答案:
Select-AzureRmSubscription -SubscriptionId "XXXX-XXXX-XXXX-XXXXX-XXXXXX" Select-AzureRmSubscription : Please provide a valid tenant or a valid subscription. Au caractère Ligne:1 : 1 + Select-AzureRmSubscription -SubscriptionId "XXXX-XXXX-XXXX-XXXXX-X ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError : (:) [Set-AzureRmContext], ArgumentException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.SetAzureRMContextCommand
當我這樣做時
Get-AzureRmSubscription
:Get-AzureRmSubscription AVERTISSEMENT : Unable to acquire token for tenant 'XXXXX-XXXX-XXXX-XXXX-XXXX' AVERTISSEMENT : Unable to acquire token for tenant 'XXXXX-XXXX-XXXX-XXXX-XXXX' AVERTISSEMENT : Unable to acquire token for tenant 'XXXXX-XXXX-XXXX-XXXX-XXXX' AVERTISSEMENT : Unable to acquire token for tenant 'XXXXX-XXXX-XXXX-XXXX-XXXX' AVERTISSEMENT : Unable to acquire token for tenant 'XXXXX-XXXX-XXXX-XXXX-XXXX' Name Id TenantId State ---- -- -------- ----- Microsoft Partner Network XXXXX-XXXX-XXXX-XXXX-XXXX XXXXX-XXXX-XXXX-XXXX-XXXX Enabled Microsoft Azure XXXXX-XXXX-XXXX-XXXX-XXXX XXXXX-XXXX-XXXX-XXXX-XXXX Enabled XXXX - XXXXXXX XXXXX-XXXX-XXXX-XXXX-XXXX XXXXX-XXXX-XXXX-XXXX-XXXX Enabled
在它起作用之前,在 Azure 的 Portal 中沒有任何變化。
你能幫助我嗎 ?
感謝您
我無法使用評論。
是否其他訂閱基於不同的租戶?如果是這種情況,請嘗試使用
Connect-AzureRmAccount -TenantId