Forum Discussion
alwaysLearner
Jun 08, 2025Iron Contributor
Unable to delete tenant
I want to delete a single tenant I've created some time ago using my personal MS account (@outlook.com). The goal is to start fresh. In the Manage tenants page I see this 'All initial checks passed. ...
Kidd_Ip
Jun 09, 2025MVP
Let's try to use PowerShell to manually remove any lingering enterprise applications:
- Open Windows PowerShell as an administrator.
- Run: Import-Module AzureAD
- Connect to Azure AD: Connect-AzureAD
- Retrieve enterprise applications: Get-AzureADServicePrincipal
- Identify and remove any remaining applications using: Remove-AzureADServicePrincipal -ObjectId <Object ID>
alwaysLearner
Jun 09, 2025Iron Contributor
Thanks for the reply.
I had around 100 apps there and I could delete most of them. However, now I have 33 apps still remaining and can't delete them. They seem to be 'internal' to MS apps. Here is error message.
PS C:\windows\system32> Remove-AzureADServicePrincipal -ObjectId "ee8b712f-88cf-4165-ae03-cdc97ab6017f"
Remove-AzureADServicePrincipal : Error occurred while executing RemoveServicePrincipal
Code: Request_BadRequest
Message: Specified App Principal ID is Microsoft Internal.
RequestId: 0fd480d3-7d18-4fc9-8d56-363c04935fb8
DateTimeStamp: Mon, 09 Jun 2025 07:47:07 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:1 char:1
+ Remove-AzureADServicePrincipal -ObjectId "ee8b712f-88cf-4165-ae03-cdc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-AzureADServicePrincipal], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.RemoveServicePrincipal
And these are some of those 33 apps:
The thing is, I've passed all the checks:
But still can't delete the tenant: