Part of the job of Microsoft 365 administrators is to ensure that their users can access and work with all services. This also includes ensuring that applications work. Microsoft Entra manages applications and the associated settings in a central location. It is relevant to know when application certificates and secrets expire in order to renew them in a timely manner. This article shows how you can query which applications need to be updated.
A sample app
To demonstrate this task with a sample, we create a new app MyApp1 in the Azure portal. We add a redirect URL, a certificate, 2 secrets, and some more app properties, as here.
Get all apps
We can use the Microsoft Graph API to get a list of all registered apps in the M365 tenant. Graph Explorer helps to try it out. The screenshot shows the request, and the required permissions.
Get secrets and certificates expiration date of one app
We can now use the appId of an application, and ask for the application properties, as the article Get application describes. For our sample MyApp1, we use the appId from above with the following request and syntax:
The result shows a bunch of application properties. Relevant for use are the following properties that deliver an array :
- keyCredentials = certificates
- passwordCredentials = secrets
- requiredResourceAccess = permissions
As always, we should use the $select method to reduce the result and to select only the relevant data in real world. We should append the select query as here:
We see the endDateTime per secret and certificate.
"displayName": "my personal certificate",
Here we get secret1, secret2, and the my personal certificate with their end dates, and eventually more application properties if needed. The date and time at which the password expires represented using ISO 8601 format and is always in UTC time, see more here.
With this information we can automate the task and send notifications when the expiration date is in the near future, e.g. alert admins 30 days before expiry.
This functionality will also be part of our Governance Toolkit 365 (GT365) in the next version. Stay tuned with many updates coming with customizable solutions of GT365 and check it out!
Application management can be done and automated with the help of Graph.