Managing external identities to enable secure access for partners, customers, and other non-employees
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:
- Install required PowerShell modules
Install-Module Microsoft.Graph Install-Module -Name Az - Connect to the correct tenant with Microsoft Graph
Use an admin account homed in the tenant being deleted (not a guest):
Run this to confirm the tenant context:Connect-MgGraph -Scopes "Application.ReadWrite.All"
Verify the tenant ID andGet-MgDomainonmicrosoft.comdomain match the tenant to be deleted. - Confirm Az context to avoid affecting the wrong tenant
Ensure the tenant information matches the tenant you want to remove.Clear-AzContext -Scope CurrentUser Connect-AzAccount -Tenant <object id of the tenant you are attempting to delete> Get-AzContext - 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 } - 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 } - Retry tenant deletion
- Sign in to the Microsoft Entra admin center as a Global Administrator.
- Go to Microsoft Entra ID → Overview → Manage tenants.
- Select the tenant and choose Delete.
- 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: