How To Use App Registration Deactivation
If you’ve been following the steady stream of updates coming out of Entra, you may have noticed a particularly powerful addition to the Microsoft Graph API: the ability to deactivate app registrations. It’s a deceptively simple feature with major implications for anyone responsible for managing the ever‑growing list of applications inside their organization.
In this post, I’ll break down why this matters, how it can help you regain control of your app landscape, and—most importantly—how to automate it. I spent a good chunk of time figuring this out so you don’t have to.
So… what exactly is this new feature?
In short: you can now cleanly deactivate an app registration without deleting it.
Historically, if you needed to stop an app from being used in your tenant, your only real option was to delete the service principal. That worked fine for throwaway apps, but for anything with configuration, history, or future relevance, deletion was a non‑starter. You either lived with the risk or rebuilt everything later.
Instead of removing the app entirely, Entra now lets you block new access tokens immediately, while leaving all metadata, configuration, and audit history untouched. Existing tokens continue to work until they expire, giving you a safe, predictable transition window.
This makes incident response smoother, maintenance safer, and lifecycle management far less destructive—all without losing anything you might need later.
And the best part? It’s all powered through Microsoft Graph.
How to Deactivate via PowerShell
To deactivate the app via PowerShell, you will need the following permissions to deactivate:
Application.ReadWrite.All Once you have those permissions consented to (which should come up when you connect via Microsoft Graph) use the following code snippet to deactivate:
Connect-MgGraph -Scopes "Application.ReadWrite.All"
$clientId = "<>"
$uri = "https://graph.microsoft.com/beta/applications(appId='$clientId')"
$body = @{
isDisabled = $true
} | ConvertTo-Json
Invoke-MgGraphRequest -Method PATCH -Uri $uri -Body $body -ContentType "application/json"Reactivating the Application
Once we're satisfied, we can then reactivate the application by changing the variable to $false, as seen below:
Connect-MgGraph -Scopes "Application.ReadWrite.All"
$clientId = "<>"
$uri = "https://graph.microsoft.com/beta/applications(appId='$clientId')"
$body = @{
isDisabled = $false
} | ConvertTo-Json
Invoke-MgGraphRequest -Method PATCH -Uri $uri -Body $body -ContentType "application/json"Tying it all together
Using Microsoft Graph to deactivate app registrations is a clean, reversible way to take control of the applications in your tenant without resorting to drastic measures. Hopefully we’ll see this feature surface in the Entra portal soon as a simple toggle. Until then, this approach gives you a safe, predictable way to disable problematic apps without purging them outright.
Until next week folks!
Comments