Removing AppPrincipals from Office365

Posted on 5/4/2014 @ 8:09 AM in #SharePoint by | Feedback | 2904 views

So here is an annoying issue. If I have your AppPrincipal and secret, I can party as you! But as we go through our usual dev cycles, we create these ApplicationIDs. Hell Visual Studio will create them for us, to make things easy!
The problem is, many a developer, and some a ITOgre, may leave these AppPrincipalIds sitting there and not clean them up when they are done playing.

You can look for currently registered App Principals at


The problem is, that URL shows you App Principals registered AND currently in use.
Currently NOT in use App Principals are NOT shown on that page.

The same issue applies on premises also, even though here I am talking specifically about Office 365.
Getting rid of these in On-Prem is easy, just use the Object model (server side).

What are we to do in Office 365?

Answer: Look at PowerShell. And no, don’t bother looking at the SharePoint online management shell. You won’t find the answer there. Instead, look at the Windows Azure Active Directory Module for PowerShell.

Start by launching Windows Azure Active Directory Module for PowerShell, and running the following command,


This command will ask you for credentials, provide your Office 365 admin credentials here.

Next, look for all previously registered stray, not in use App Principals by using the following Command,

Get-MsolServicePrincipal –Site <enteryoursiteurlhere>

You will find a bunch of stray ApplicationIDs if you’ve been playing around with your site. Hmm!! How do I get rid of them?

Easy! Use the below Powershell –

Remove-MsolServicePrincipal –AppPrincipalId <guidhere>

Hit enter, app is gone! Keep your Office 365 clean people.
Oh and don’t delete an AppPrincipalID that Microsoft created :-)

Sound off but keep it civil:

Older comments..