如何使用 azure AD 图 API 获取客户端密钥到期日期

Adi*_*aul 5 azure azure-active-directory azure-ad-graph-api

我正在尝试获取 AAD 应用程序的客户端机密的到期日期。但是,当我使用以下图形请求时,passwordCredential 和 keyCredential 字段为空。

https://graph.windows.net/myorganization/directoryObjects/ {ServicePrincipalObjectId}/?api-version=1.6

有没有办法获取这些数据?如果我下载它,我会在清单中看到它,而不是在 Odata 对象中

感谢您的帮助!

juv*_*han 4

使用下面的 AAD Graph API:

https://graph.windows.net/{org_domain}/applications/{obj_id}/passwordCredentials
Run Code Online (Sandbox Code Playgroud)

响应将显示您的特定 AAD 应用程序使用的密钥列表。

您可以从endDate字段得出密钥的到期日期。

{
  "odata.metadata": "https://graph.windows.net/{org_domain}/$metadata#Collection(Microsoft.DirectoryServices.PasswordCredential)",
  "value": [
    {
      "customKeyIdentifier": null,
      "endDate": "2018-05-07T09:12:13.2177408Z",
      "keyId": "{your_key_id}",
      "startDate": "2016-05-07T09:12:13.2177408Z",
      "value": null
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)