This is a quick guide on deleting an Azure AD Tenant, especially when there is some stubborn enterprise applications that refuse to go away.
Few weeks ago, I was trying to delete an Azure AD that I created as a test account for my customer. I happily go to portal.azure.com, changed to the relevant directory, in this case it was ronelx.onmicrosoft.com, and try to delete it using the "delete" button. Unfortunately, it came to a pause when Azure AD complaints that I have an enterprise application that needed to be removed. Normally you can click on the button "Delete all enterprise applications" as shown in the screenshot and you can delete them manually:
Go to https://www.powershellgallery.com/packages/AzureAD/ to get the latest powershell Azure AD module
Install-Module -Name AzureAD
Once done run
You should now be able to list all the current application SPs in a directory:
Remove-AzureADServicePrincipal -objectid [enter object id here]Now that you are done, you will have to delete your user in AAD first, before deleting the Directory, or you will get a message saying you cannot delete the directory, because you have one or more users.
Reference: https://blogs.msdn.microsoft.com/ericgolpe/2015/04/30/walkthrough-of-deleting-an-azure-ad-tenant/ (this blog was written in 2015, I have updated some powershell scripts, as you can now install powershell modules through PowerShell Gallery)