我的问题是:不使用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
谢谢
当前回答
截至目前(06/07/2018),一个简单的方法是在Azure门户中运行Azure云Shell中的az帐户显示(需要存储帐户)。
——命令——
az account show
——命令输出——
{
"environmentName": "AzureCloud",
"id": "{Subscription Id (GUID)}",
"isDefault": true,
"name": "{Subscription Name}",
"state": "Enabled",
"tenantId": "{Tenant Id (GUID)}",
"user": {
"cloudShellID": true,
"name": "{User email}",
"type": "user"
}
}
有关Azure Cloud Shell的更多详细信息,请参阅Azure Cloud Shell | Microsoft Docs概述。
其他回答
截至目前(06/07/2018),一个简单的方法是在Azure门户中运行Azure云Shell中的az帐户显示(需要存储帐户)。
——命令——
az account show
——命令输出——
{
"environmentName": "AzureCloud",
"id": "{Subscription Id (GUID)}",
"isDefault": true,
"name": "{Subscription Name}",
"state": "Enabled",
"tenantId": "{Tenant Id (GUID)}",
"user": {
"cloudShellID": true,
"name": "{User email}",
"type": "user"
}
}
有关Azure Cloud Shell的更多详细信息,请参阅Azure Cloud Shell | Microsoft Docs概述。
PowerShell:
Add-AzureRmAccount #if not already logged in
Get-AzureRmSubscription -SubscriptionName <SubscriptionName> | Select-Object -Property TenantId
访问https://login.windows.net/YOURDIRECTORYNAME.onmicrosoft.com/.well-known/openid-configuration,您将看到一堆包含租户ID的url。
获取tenantID的简单方法是:
Connect-MsolService -cred $LiveCred #sign in to tenant
(Get-MSOLCompanyInformation).objectid.guid #get tenantID
我使用跟踪来获取租户id
az account show --query homeTenantId --output tsv