Forum Discussion

Jonathan_Rudolph's avatar
Jonathan_Rudolph
Copper Contributor
Sep 22, 2020

Service Principal Secrets Expiration should create an alert (Process needs improvement)

 We ran into this issue recently, where the Azure DevOps pipeline Service Principal's secret expired without any indication that this date was nearing.  I would have assumed that critical components such as this would give some alert a week or so in advance, in order to update them in a timely manner.

 The update process was also terribly confusing, and obfuscated by the preview 'View' for Service Connections, which no longer allowed editing of the password.  When we were alerted the passphrase expired, we were sent to a wizard to add a new password.  However, this does not change the password it uses only passwords that are 'available', so the process did not fix anything.
 I believe this process has some opportunity for improvement, pushing some of the management responsibilities back into Azure where they make the most sense.  (tracking them uniquely from a particular user's calendar is not an ideal solution for an enterprise product.)

  • aammirmirza's avatar
    aammirmirza
    Copper Contributor
    Use the Powershell Module.

    Install-Module -Name AzAppRegistrationExpiry

    +----------------+----------------------------------------------------------+
    | Expiry | E.g : Get-ExpiringSPN -TimeFrameInDays 30 -expiry |
    +----------------+----------------------------------------------------------+
    | InvalidExpiry | E.g : Get-ExpiringSPN -TimeFrameInDays 30 -InvalidExpiry |
    +----------------+----------------------------------------------------------+
  • jasonls's avatar
    jasonls
    Copper Contributor

    Jonathan_Rudolph 

     

    I worked with a customer where we wrote an Azure Automation Runbook to check the expiration of Service Principals and Certificates weekly and would send an email two weeks before the expiration so the change request could be reviewed by the orgs change control board.

    • Jayben's avatar
      Jayben
      Copper Contributor
      Hi Jasonls,

      Can you please help me with that runbook script?

      TYIA

Resources