如果您有租户 ID,如何获取 365 租户的域名?

问题描述 投票:0回答:1

目前,您可以使用 https://login.microsoftonline.com/{domainname}/.well-known/openid-configuration

的 GET 响应获取与 365 租户关联的给定域的租户 ID

但是,我无法找到一种方法来获取给定的租户 ID 并获取与该租户关联的域。有没有办法至少获得给定租户的主域?

这是假设与给定租户不存在现有合作伙伴/经销商关系,因此 AFAICT 我无法在 https://learn.microsoft.com/en-us/graph/api/managementtenants-tenant 上使用托管租户的 ID -get?view=graph-rest-beta&tabs=http

我已经尝试过 https://login.microsoftonline.com/{tenant-id}/.well-known/openid-configuration 并且给出了响应,但似乎没有任何内容包含任何租户域,也没有似乎包含任何指向将返回它的 url 的指针 AFAICT。

microsoft-graph-api office365 office365api
1个回答
0
投票

我正在使用 组织端点

https://graph.microsoft.com/v1.0/organization

它返回租户 ID 和经过验证的域

{
    "value": [
        {
            "id": "<tenant id>",
            "displayName": "Contoso",
            ...
            "verifiedDomains": [
                {
                    "capabilities": "Email, OrgIdAuthentication",
                    "isDefault": false,
                    "isInitial": false,
                    "name": "contoso.eu",
                    "type": "Managed"
                },
                {
                    "capabilities": "Email, OfficeCommunicationsOnline",
                    "isDefault": false,
                    "isInitial": true,
                    "name": "contoso.onmicrosoft.com",
                    "type": "Managed"
                },
                {
                    "capabilities": "Email, OfficeCommunicationsOnline, OrgIdAuthentication, Yammer",
                    "isDefault": true,
                    "isInitial": false,
                    "name": "contoso.com",
                    "type": "Managed"
                }
            ]
        }
    ]
}

另一种选择是使用 findTenantInformationByTenantId

GET https://graph.microsoft.com/v1.0/tenantRelationships/findTenantInformationByTenantId(tenantId='{id}')

回应

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.tenantInformation",
    "tenantId": "xxx",
    "federationBrandName": null,
    "displayName": "Edxxx",
    "defaultDomainName": "edxxx"
}
© www.soinside.com 2019 - 2024. All rights reserved.