Friday, 7 June 2019

Deleting Azure Active Directory Tenant – Unable to delete all Enterprise Applications - Can't Delete Azure DevOps from within User Interface

Encountered an issue today with removal of an Azure AD Tenant that is no longer used. When attempting to delete the Azure AD Directory - I simply received warnings that I had to "Delete All Enterprise Applications" - with a warning status indicator.

When I tried to remove the single Azure Enterprise Application (Azure DevOps) - the Delete button was disabled. As you could imagine - this put me in a bit of a pickle!

The fix that worked for me is as follows:

1. Create a new Global Admin account in the Azure Active Directory you are trying to delete. Make sure you copy the temporary password as you'll need to log in with it.

2. To ensure you have the Azure AD Powershell extensions, Start Powershell and run:
Install-Module -Name AzureAD

3. Once done run Connect-AzureAD. You will be prompted to login. Login with the user you created and will be asked to change your password.


4. Run
Get-AzureADServicePrincipalto retrieve the Object Id of the Enterprise Application that you can't delete.

5. Run
Remove-AzureADServicePrincipal -objectid [enter objectid here] directly.

6. Remove your temporary user.

You should now be able to delete your Azure Active Directory (Azure AD) Tenant instance.

Source: https://blogs.msdn.microsoft.com/kennethteo/2017/09/19/deleting-azure-ad-tenant/