Skip to content

Instantly share code, notes, and snippets.

@dcasati
Last active January 11, 2022 22:38
Show Gist options
  • Save dcasati/a8e5600429a38982620a7eedf5bb6e76 to your computer and use it in GitHub Desktop.
Save dcasati/a8e5600429a38982620a7eedf5bb6e76 to your computer and use it in GitHub Desktop.
batch remove Service Principals not being used
az_rm_sp()(az ad sp list --show-mine -o json --query "[?contains(displayName, '$1')]" | jq -r '.[] | .appId' | xargs -P 4 -n 12 -I % az ad sp delete --id %)
example:
az_rm_sp azure-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment