Freigeben über


Error while trying to Deleting Azure AD due to Visual Studio Online association

Off late I ran into an issue with Azure AD. I created a new AD, added users and associated a few apps like Office 365 and Visual Studio to this new AD. I wanted to make sure my AD users can access these apps and it all worked fine.

This while exercise was for a demo which I can giving to a customer. Once the demo was over, I deleted the VSO accounts and then wanted to delete the Azure Account. This is where the issue was. When I try deleting the AD, it refused that action saying I cannot delete it unless all users and Apps were removed and there is no way to remove VSO and O365 Management API app associations even though all the Linked VSO accounts were unlinked.

The only way I could do this is using Azure AD PowerShell. You would have to follow Install the Azure AD Module before attempting this PowerShell. Also make sure you REALLY REALLY want to delete the AD.

 

Connect-MsolService  - This will prompt you to login. You would have to use an AD user account a nd not your Microsoft one.

Get-MsolServicePrincipal | Remove-MsolServicePrincipal - This will remove the VSO association from the AD from which it can. Make sure you have logged in using an account who is an Admin in the account you want to delete.

For more details on removing Service Principal, refer https://msdn.microsoft.com/en-us/library/azure/dn194113.aspx

I was really stuck on this and I hope this helps others who might be stuck.