Skip to content

Instantly share code, notes, and snippets.

@DarranShepherd
Last active April 25, 2017 12:38
Show Gist options
  • Save DarranShepherd/4ddc992b64f899d18b1d0d7560121755 to your computer and use it in GitHub Desktop.
Save DarranShepherd/4ddc992b64f899d18b1d0d7560121755 to your computer and use it in GitHub Desktop.
List service principal certificates expiring in the next 7 days
Get-AzureRmADApplication |% {
$app = $_;
Get-AzureRmADAppCredential -ApplicationId $_.ApplicationId `
| Where-Object { $_.Type -eq "AsymmetricX509Cert" -and (Get-Date $_.EndDate) -lt (Get-Date).AddDays(7) } |% {
Write-Host "Cert for application $($app.DisplayName) ($($app.ApplicationId)) expires on $($_.EndDate)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment