Search code examples
azurepowershellazure-cloud-shell

How do I delete an Azure Enterprise Applications without Azure subscription?


I want to remove a tenant from Azure portal.

All Enterprise applications should be deleted before the tenant removing:

enter image description here

There are two options how Enterprise applications could be removed:

  1. From the Azure portal. Go to the application you want to delete, click "Properties", click "Delete" button. This option is not available as "Delete" button is disabled.
  2. Using PowerShell commands with Azure Cloud Shell. This option is not available because it states "No valid subscription found. You need an Azure subscription to use Azure Cloud Shell".

I don't want to activate an Azure subscription just for the removing tenant.

But all options are useless in this case.

Any alternative approach?


Solution

  • You should be able to delete the enterprise application in the portal, make sure you logged in to the portal with the Global admin account.

    If this still not work, try to use powershell in local(not in cloud shell).

    1.Install the AzureAD module.

    Install-Module -Name AzureAD
    

    2.Login with Global admin account.

    Connect-AzureAD -TenantId <TenantId>
    

    3.Delete the enterprise application.

    Remove-AzureADServicePrincipal -ObjectId <app objectid got from the portal>