Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Find all Service Principals with credentials expiring in the next 60 days
az ad sp list \
--all \
--query "[?passwordCredentials[0].endDate<='$(date -d "+60 days" +%Y-%m-%d)'||keyCredentials[0].endDate<='$(date -d "+60 days" +%Y-%m-%d)'].{\"App ID Display Name\":appDisplayName,\"SP appId\":appId,\"Password Expiry Date\":passwordCredentials[0].endDate, \"Key Expiry Date\":keyCredentials[0].endDate}" \
-o table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment