Wriju's BLOG

.NET, Cloud and everything

Delete an Azure Active Directory

Problem

When you try to delete an Active Directory you will go crazy because 

image

You will get an error

image 

You will clean all the users but will still get the below error.

image 

You try to clean up all the applications in the list of applications. You select “Applications my Company owns” and the do the filter, you will find no applications.

image

But when you select “Applications my company uses”  you will get

image

And you will not be able to delete this entry.

Solution

Here are the steps.

First one Azure Active Directory PowerShell

image

If this is not available then please download it from Azure Active Directory Module for Windows PowerShell (64-bit version) http://go.microsoft.com/fwlink/p/?linkid=236297

Go ahead and create an user called “delete”

image

image

image

image

you need to login once to change the default password. So use https://login.microsoftonline.com/ and change the default password

image

This user is required login to the power shell.

After we have the PowerShell we can run (optional)

Import-Module MSOnline

After that run

Connect-MsolService

This will prompt the login and here you will pass the Global Admin user name and password created above. You should not get any error here.

image

Then run Get-MsolServicePrincipal | Remove-MsolServicePrincipal

You will get a lot of errors just ignore them

image

You are almost done. You need to go to portal and delete the user

Now should be able to delete it.

image

Namoskar!!!