In Azure, We are having service principal for client apps in Azure. We want to set up an alert to our group, some days before the expiry of the secret. So that we can generate new ones and update our apps without downtime. Is there any way to get an alert? If not how to manage these?
2
Answers
AFAIK, There is no way you can get an alert about Secret Expiry for Service Principal.
But if you want to know about the expiry dates of Secrets then you can follow below process:
Then follow below process:
You can manually check which service expires by following above process.
Another way of managing these are when creating these Secrets you will have something called Expires as below:
So if we keep maximum 2 yrs then it will expire after 2 yrs of creation. If you keep 90 days it will expire after 90 days.
You can monitor the expiry using Logic Apps too.
You can leverage the Graph Api to get a list of applications withs secrets that are about to expire. If you combine this with a Timer Triggered Azure Function you can create an alert and/or create a new secret automatically.
I’ve created an Azure Function that can act as a source of inspiration, see this repo. It contains a class that lists all secrets and certificates that are about to expire