如何在服务主体机密到期之前生成新凭据

问题描述

您好,我想在当前客户端机密自动过期之前为服务主体自动生成客户端机密,这是最好的方法

解决方法

您可以使用 Microsoft Graph API 来执行此操作,只需尝试以下请求:

请求网址:

POST https://graph.microsoft.com/v1.0/myorganization/applications/<app_object_id>/addPassword

请求正文

{
    "passwordCredential": {
        "displayName": "<secret name>","endDateTime": "2023-04-20T08:49:57.334Z","startDateTime": "2021-04-20T08:50:07.909Z"
    }
}

结果: enter image description here

enter image description here

如果您还有其他问题,请告诉我。