Home > Azure > Delete Azure AD

Delete Azure AD

2016/07/18

I had created an AD directory named alextestad in my Azure subscription in order to do some experiments, after that i tried to delete this temp AD, but i received

After some struggle i found how to do.
First must be added an Global admin user to this AD, in my case I added a user named “tobedeleted”



Clicking on create you get a temporary password:

At this point using another browser in a new Private window point to https://manage.windowsazure.com and login with the new account:

And immediately is requested to change the password:

At this point by clicking the button the login is done, obviously there is no subscription

but is not important.
At this point we need to install 2 things on our pc (found info here):
Microsoft Online Services Sign-In Assistant for IT Professionals RTW
Azure Active Directory Module for Windows PowerShell (64 bit)
Done this in the Azure Powershell we can launch

$objCred = get-credential

This causes the request of login where we use the credentials of the new user:

and then

connect-msolservice -credential $objCred

done this , we can launch in Powershell

Get-MsolServicePrincipal | Select DisplayName

This instructions lists all the applications Service Principals in AD, in my case

Now we can delete all not required apps in AD tenant

Get-MsolServicePrincipal | Remove-MsolServicePrincipal

where I got some errors but it seems no problem

Reissuing Get-MsolServicePrincipal | Select DisplayName in my case we had

Now in Azure portal is needed to delete the temp user, with the DELETE button at the end of this page

Done this, finally no errors while trying to delete the AD:

Advertisements
Categories: Azure
%d bloggers like this: