2017-02-01 20 views
0

我將TenantA AD的「外部用戶」添加到Azure中的TenantB中,並將其作爲「所有者」添加到B訂閱中的一個。如何使用外部用戶信用與Azure中的其他租戶進行PowerShell連接?

如何使用該外部用戶與TenantB訂閱連接PowerShell?

Login-AzureRmAccount /而在-Credential使用外部用戶的UPN和指定TenantB的tenantId/subscriptionId Add-AzureRmAccount給我的錯誤:

add-azurermaccount : The provided account <...> does not have access to subscription ID "<...>". Please try logging in with different credentials or a different subscription ID.**

望着TenantB的Get-MsolUser輸出,我可以在下面看到外部用戶從tenantA形式:

PS C:\> get-msoluser 

UserPrincipalName               DisplayName  isLicensed 
-----------------               -----------  ---------- 
<username>_tenantA.onmicrosoft.com#EXT#@tenantB.onmicrosoft.com <..> False 

回答

0

我將開始使用清除緩存的憑據:

Get-AzureAccount | ForEach-Object { Remove-AzureAccount $_.ID -Force } 

然後使用Login-AzureRmAccount並輸入憑證TenantA。您應該可以使用切換訂閱。

Select-AzureRmSubscription -SubscriptionName 
+0

謝謝。 不幸的是,TenantA creds登錄並嘗試切換到使用-SubscriptionId和-TenantId在TenantB訂閱給出了這樣的錯誤: 選擇-AzureRmSubscription:提供訂閱<...>不存在 我懷疑選擇-AzureRmsubscription正在尋找TenantA中的訂閱,因爲我可以使用Get-AzureRmTenant來驗證TenantA的上下文。 –

+0

如果您使用TeantA信用登錄門戶,您是否可以看到TeanantB訂閱? –

+0

在TenantA的Azure門戶中,我看不到TenantB的訂閱,我有「所有者」訪問權限。 順便說一句,我只是通過運行Get-AzureRmRoleAssignment,並在那裏列出我的外部用戶來重新檢查權限是否存在於有問題的訂閱中: SignInName:user_tenantA.onmicrosoft.com#EXT#@tenantB.onmicrosoft.com RoleDefinitionName:Owner –

相關問題