Errors When Attempting to Delete Azure AD Tennant
When trying to delete an Azure AD Directory and getting an error to delete applications, try:
1) in properties, give your account access to manage resources. (Azure AD -> Properties -> Access management for Azure resources)
2) disable LinkedIn integration and try again.
3) sign out and sign back in again, and keep refreshing the browser.
4) can take about 5-10 minutes to refresh Azure AD tennant.
5) make sure the default directory for your logon user is not the one you are trying to delete. Set a different default, not leaving it as last directory you signed in on.
If that doesn't work, try:
In Summary:
Deleting Enterprise Applications
It appears that what you can’t see from the Portal UI, you must figure out how to deal with using PowerShell. As the name suggests, PowerShell is a powerful tool that interacts with Azure. Use the following steps:
- Run PowerShell as Administrator.
- Enter the Connect-AzureAD command and log in with your Azure AD Global Administrator account.
- Enter Get-AzureADServicePrincipal to display all registered Enterprise Applications along with their ObjectIds
- For each record found, run following command:
- Remove-AzureADServicePrincipal -objectid <ObjectId from above>
- If you prefer, you can find and delete all Enterprise Applications using the following script:
-
$ObjectIds = (Get-AzureADServicePrincipal).ObjectId
For ($i=0; $i -lt $ObjectIds.Length; $i++)
{
Remove-AzureADServicePrincipal -objectid $ObjectIds[$i]
}
NOTE: If you receive the following error for any of the above, simply continue. Basically, the error states that it won’t let you delete Microsoft internal app: