我的问题是:不使用powershell命令可以获得azure活动目录租户id吗?
我找到了这两个博客,有了这个帮助,我已经能够从powershell获得租户ID和订阅ID。这是找回房客的唯一方法吗?
在Windows PowerShell中获取Windows Azure活动目录租户ID
Windows Azure AD认证支持PowerShell
谢谢
我的问题是:不使用powershell命令可以获得azure活动目录租户id吗?
我找到了这两个博客,有了这个帮助,我已经能够从powershell获得租户ID和订阅ID。这是找回房客的唯一方法吗?
在Windows PowerShell中获取Windows Azure活动目录租户ID
Windows Azure AD认证支持PowerShell
谢谢
当前回答
我使用跟踪来获取租户id
az account show --query homeTenantId --output tsv
其他回答
For AAD-B2C it is fairly simple. From Azure Portal with a B2C directory associated, go to your B2C directory (I added the "Azure AD B2C" to my portal's left menu). In the B2C directory click on "User flows (policies) directory menu item. In the policies pane click on one of your policies you previously added to select it. It should open a pane for the policy. Click "Properties". In the next pane is a section, "Token compatibility settings" which has a property "Issuer". Your AAD-B2C tenant GUID is contained in the URL.
PowerShell:
Add-AzureRmAccount #if not already logged in
Get-AzureRmSubscription -SubscriptionName <SubscriptionName> | Select-Object -Property TenantId
如果您已经在您的机器中安装了Azure CLI 2.0,那么您应该能够使用以下命令获得您所属的订阅列表:
az login
如果你想看到一个表输出,你可以使用
az account get-access-token --query tenant --output tsv
或者你可以使用Rest API
租户-列表|微软文档
xxx@Azure:~$ az ad sp create-for-rbac
Retrying role assignment creation: 1/36
{
"appId": "401143c2-95ef-4792-9900-23e07f7801e7",
"displayName": "azure-cli-2018-07-10-20-31-57",
"name": "http://azure-cli-2018-07-10-20-31-57",
"password": "a0471d14-9300-4177-ab08-5c45adb3476b",
"tenant": "e569f29e-b008-4cea-b6f0-48fa8532d64a"
}
只是为一个老问题(但仍然相关的问题)添加一个新方法。 在新的门户中,在任何屏幕上单击帮助图标并选择“显示诊断”将显示一个JSON文档,其中包含所有租户信息,包括TenantId、租户名称以及更多有用的信息