I'm trying to build a cleanup
script that removes azure app registration from the cloud account.
From Azure documentation, I built a delete command but received an error.
I have the permission to remove the app registration manually, but the command failed.
The command that I ran:
Remove-AzureADApplication -ObjectId "$appRegistryObjectId"
The error that I received:
Remove-AzureADApplication: Error occurred while executing RemoveApplication
Code: Request_BadRequest
Message: Value cannot be null.
Parameter name: requestContext
RequestId: 948d5c0c-e012-4ae8-b042-e6ae84ad4512
DateTimeStamp: Sun, 15 Oct 2023 12:31:29 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
Can someone assist?
I have one Application in my environment like below:
To remove
Remove-AzureADApplication
ensure that you are passing correctobjectID
values:In portal App removed successfully like below:
Reference:
Remove-AzureADApplication (AzureAD) | Microsoft Learn
This error occurring if your account type is in
AzureADandPersonalMicrosoftAccount
Make sure to change
"signInAudience": "AzureADMultipleOrgs",
like below:Now, when I ran the same code App removed successfully.
Update
To can change
signInAudience: "AzureADMultipleOrgs",
and remove application using below command:Now App registration change to
AzureADMultipleOrgs
andremoved Application
successfully like below: