使用Graph REST API获取SharePoint App详细信息

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

我有一个使用appreg.aspx注册的提供商托管SharePoint应用程序。我想使用Azure函数获取该应用程序的详细信息,例如应用程序名称,客户端密钥的开始和结束日期,以便我可以在应用程序客户端密钥到期之前发送警报。我已经使用PowerShell脚本将日期增加到3年。

我遇到了一个问题,Alert on Client Secret Key Expiry。但似乎解决方案比较老。我已经使用PowerShell脚本来获取应用程序详细信息,但是我想使用Azure函数,因为我已经拥有很少的其他函数,因此维护它们将更加容易。

是否可以使用Graph REST API获取应用程序详细信息?

谢谢!

sharepoint azure-ad-graph-api provider-hosted
1个回答
0
投票

使用https://graph.microsoft.com/beta/servicePrincipals?$filter=appId eq '{app id of your app registered in SharePoint}'获取应用程序详细信息。

您可以在响应中找到客户端密码endDateTime(还包括应用程序名称):

        "passwordCredentials": [
            {
                "customKeyIdentifier": null,
                "endDateTime": "2021-01-16T01:56:20.4750596Z",
                "keyId": "653b5550-23c0-4bff-9fab-f34e91d23dc6",
                "startDateTime": "2020-01-16T01:56:20.4750596Z",
                "secretText": null,
                "hint": null,
                "displayName": null
            }

请参见参考文献here。您可以在Microsoft Graph Explorer中进行测验测试。

© www.soinside.com 2019 - 2024. All rights reserved.