App Registration Expiration Monitoring and Notifications

Posted by

This post has been republished via RSS; it originally appeared at: Core Infrastructure and Security Blog articles.




Problem Statement 

Azure services do not have a native feature to report on expiring App registrations. Without a solution in place to monitor and notify on expiration of these SPN’s solutions ranging from Custom Apps, and DevOps CI\CD Pipelines too orchestration engines like Azure Automation and Logic Apps, can and will cease to function without notice. 

  • Purpose of this solution: To provide an automated mechanism of calculating and ingesting the expiration dates into Log Analytics and automatically notify resources when expiration is within threshold. 
  • Requisites: This solution consists of: 
  • 1 Runbook consisting of the PowerShell script in this document. 
  • 2 Automation Variables containing the Log Analytics Workspace ID and the Log Analytics Primary Key. 
  • 1 SPN in the monitored cloud environment with Global Reader role. 

Solution Overview 

The solution is designed to be cross tenant and requires an App Registration\SPN in the desired environment with Global Reader rights. Utilizing Azure Automation (AA) and AA resources like Variables and Credentials our runbook pulls an array of SPN’s from the environment and calculates the time until expiration before using our custom function to send the data to a Log Analytics Workspace. Finally, Azure Monitor alerts can be triggered based on a Kusto query to notify resources that there are SPN’s within the threshold for expiration. 


Where can I get this solution? 

The solution is documented in detail on my GitHub repo and available for consumption immediately. 

This articles are republished, there may be more discussion at the original link. But if you found this helpful, you're more than welcome to let us know!

This site uses Akismet to reduce spam. Learn how your comment data is processed.