Skip to content

Instantly share code, notes, and snippets.

@garrytrinder
Last active November 24, 2023 09:44
Show Gist options
  • Save garrytrinder/6982a3e75bcba628ee0ea9abdae5ee55 to your computer and use it in GitHub Desktop.
Save garrytrinder/6982a3e75bcba628ee0ea9abdae5ee55 to your computer and use it in GitHub Desktop.
Remove Azure AD app registrations
# assumes you are logged into tenant using CLI for Microsoft 365 (https://aka.ms/cli-m365)
$notToRemove = @("app1","app2")
$apps = m365 aad app list | ConvertFrom-JSON
$apps | Where-Object { $_.displayName -notin $notToRemove } | ForEach-Object { m365 aad app remove --appId $_.appId --force }
@garrytrinder
Copy link
Author

Replaced --confirm with --force due to v7 breaking change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment