0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Azure CLI] テナント内のアプリケーションオブジェクトをすべて削除するワンライナー [PowerShell]

0
Posted at

検証環境に不要なアプリケーションオブジェクトが溜まってまとめて消したくなった時などに。

az ad app list | ConvertFrom-Json | ForEach-Object { az ad app delete --id $_.appId }

トラブルシュート

一部のアプリケーションオブジェクトで以下のエラーが発生して削除に失敗。

Value cannot be null.
Parameter name: requestContext

下記ページによると Azure CLI が Azure AD Graph API を利用していることが原因と思われる。
https://githubmemory.com/repo/Azure/azure-cli/issues/18738

Microsoft Graph API を呼び出すことで解決。

az ad app list | ConvertFrom-Json | ForEach-Object { az rest --method DELETE --url https://graph.microsoft.com/v1.0/applications/$($_.objectId) }

Microsoft Graph 版 Azure CLI がリリースされたら解決すると思われる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?