Microsoft Graph REST API v1.0中addKey的响应中返回值

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

[使用旧的Azure AD Graph API(v1.6)与addKey运行POST时,https://graph.windows.net/tenant_id/applications/app_oid/addKey?api-version=1.6,我得到一个响应主体,其返回值包含新创建的keyCredential:的keyId

    "statusCode": 200,
    "body": {
        "odata.metadata": "https://graph.windows.net/tenantid/$metadata#Collection(Microsoft.DirectoryServices.KeyCredential)",
        "value": [
            {
                "customKeyIdentifier": "A053F5114BC7F7C07F700CF2C4ACE47BBFD82D23",
                "endDate": "2022-06-08T14:34:03Z",
                "keyId": "fbbaf346-168a-4c90-97ca-346bcd43988d",
                "startDate": "2020-06-08T14:34:03Z",
                "type": "AsymmetricX509Cert",
                "usage": "Verify",
                "value": null
            }
        ]
    },

[使用最新版本的Microsoft Graph API通过addKey运行POST时,https://graph.microsoft.com/v1.0/applications/app_oid/addKey,我得到一个响应主体,但没有包含新创建的keyCredential的keyId的返回值(已创建新的keyCredential,并且可以在Azure门户中属于该应用程序的keyCredentials列表中看到它):

    "statusCode": 200,
    "body": {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.keyCredential"
    }

是否有一种方法可以在响应中获取包含keyId的返回值(就像上面的Azure AD Graph API v1.6示例一样?

azure-active-directory microsoft-graph
1个回答
0
投票

根据Ms graph document,通过使用获得odata.context

POST https://graph.microsoft.com/v1.0/applications/{id}/addKey

并且您可以通过使用以下查询来获取密钥证书的密钥ID。

https://graph.microsoft.com/v1.0/applications/id
© www.soinside.com 2019 - 2024. All rights reserved.