azureblog.co.uk
← cd ~/tools
Plan and check

Secret expiry tracker

Load an export of your app registrations and see every client secret and certificate in the order they expire, with the apps that are already broken at the top. Then download an Outlook calendar with a reminder before each one runs out.

  • Free
  • Runs in your browser
  • No sign-up

Runs entirely in your browser. Nothing you paste is sent anywhere.

Not sure how to get it? See get the export below. Microsoft never returns secret values when you read an app, so the export only holds names, IDs and dates. The sample is made up: contoso.com and every app in it are fictional.

Get the export

With Microsoft Graph PowerShell. Application.Read.All is enough, and it only reads. The export is saved to C:\Temp\apps.json (the folder is created if it doesn't exist), ready to load with load export above.

powershell6 lines1 changes something · hover a line number for notes
Connect-MgGraph -Scopes "Application.Read.All"
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null

Get-MgApplication -All -Property DisplayName,AppId,PasswordCredentials,KeyCredentials |
  Select-Object DisplayName, AppId, PasswordCredentials, KeyCredentials |
  ConvertTo-Json -Depth 5 | Out-File C:\Temp\apps.json -Encoding utf8
What each line does
  1. Line 1: Signs in to Microsoft Graph with the permissions (scopes) listed.
  2. Line 2: Creates an item. Makes a change.
  3. Line 4: Reads application details from Microsoft Graph.
  4. Line 5: Keeps only the properties listed, so the output stays small.
  5. Line 6: Turns the results into JSON text.

SAML single sign-on certificates live on the enterprise app (the service principal), not the app registration. To include them, export those too (to C:\Temp\enterprise-apps.json) and load both files together:

powershell4 lineshover a line number for notes
Get-MgServicePrincipal -All -Property DisplayName,AppId,ServicePrincipalType,KeyCredentials,PasswordCredentials |
  Where-Object { $_.KeyCredentials -or $_.PasswordCredentials } |
  Select-Object DisplayName, AppId, ServicePrincipalType, KeyCredentials, PasswordCredentials |
  ConvertTo-Json -Depth 5 | Out-File C:\Temp\enterprise-apps.json -Encoding utf8
What each line does
  1. Line 1: Reads service principal details from Microsoft Graph.
  2. Line 2: Keeps only the items that match the condition.
  3. Line 3: Keeps only the properties listed, so the output stays small.
  4. Line 4: Turns the results into JSON text.

Or with the Azure CLI, from PowerShell:

powershell4 lines1 changes something · hover a line number for notes
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null
az ad app list --all `
  --query "[].{displayName:displayName, appId:appId, passwordCredentials:passwordCredentials, keyCredentials:keyCredentials}" `
  -o json | Out-File C:\Temp\apps.json -Encoding utf8
What each line does
  1. Line 1: Creates an item. Makes a change.
  2. Line 4: Writes the output to a file.

Or in Graph Explorer, run this and copy the response:

http1 line
GET https://graph.microsoft.com/v1.0/applications?$select=displayName,appId,passwordCredentials,keyCredentials&$top=999

The calendar

How it works