Cannot delete Microsoft Entra tenant - system enterprise applications blocking deletion

Shubham Kumar 0 Reputation points
2026-04-21T06:53:03.6233333+00:00

Hello,

I am trying to delete my Default Directory tenant (Tenant ID: PII) as part of closing my personal Microsoft account.

The tenant deletion checklist shows all items green except for 'Enterprise Applications', which has an orange warning with a 'Delete all enterprise applications' link. However, when I click that link, the Enterprise Applications page shows 0 applications.

I investigated further using Microsoft Graph PowerShell and found approximately 20 service principals still present in the tenant. All of them are owned by Microsoft's tenant (AppOwnerOrganizationId: PII)

Microsoft Security | Microsoft Entra | Microsoft Entra External ID

1 answer

Sort by: Newest
  1. AI answer

    2026-04-21T06:53:18.1133333+00:00

    To delete the Microsoft Entra tenant when the checklist is blocked by Enterprise Applications but the portal shows none, remove or disable the remaining service principals by using Microsoft Graph PowerShell, then retry tenant deletion.

    Follow these steps:

    1. Install required PowerShell modules
         Install-Module Microsoft.Graph
         Install-Module -Name Az
      
    2. Connect to the correct tenant with Microsoft Graph Use an admin account homed in the tenant being deleted (not a guest):
         Connect-MgGraph -Scopes "Application.ReadWrite.All"
      
      Run this to confirm the tenant context:
         Get-MgDomain
      
      Verify the tenant ID and onmicrosoft.com domain match the tenant to be deleted.
    3. Confirm Az context to avoid affecting the wrong tenant
         Clear-AzContext -Scope CurrentUser
         Connect-AzAccount -Tenant <object id of the tenant you are attempting to delete>
         Get-AzContext
      
      Ensure the tenant information matches the tenant you want to remove.
    4. Remove service principals (enterprise applications) Run the following command. Execute it multiple times until no more removable service principals remain, because some deletions can fail on first attempt due to dependencies:
         Get-MgServicePrincipal -All | ForEach-Object { Remove-MgServicePrincipal -ServicePrincipalId $_.Id }
      
    5. If some service principals cannot be deleted, disable them and retry For service principals that are not removable but are blocking deletion, first disable them, then attempt removal again:
         $ServicePrincipalUpdate = @{ "accountEnabled" = "false" }
         
         Get-MgServicePrincipal -All | ForEach-Object { 
             Update-MgServicePrincipal -ServicePrincipalId $_.Id -BodyParameter $ServicePrincipalUpdate 
         }
         Get-MgServicePrincipal -All | ForEach-Object { 
             Remove-MgServicePrincipal -ServicePrincipalId $_.Id 
         }
      
    6. Retry tenant deletion
      1. Sign in to the Microsoft Entra admin center as a Global Administrator.
      2. Go to Microsoft Entra IDOverviewManage tenants.
      3. Select the tenant and choose Delete.
      4. If all checks (including Enterprise Applications) are now green, complete the deletion.

    If any Microsoft-owned service principals still cannot be removed, they may not block deletion after being disabled; re-run the deletion check in the portal after the steps above.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.