Remove-MgApplicationOwnerByRef is a Microsoft Graph PowerShell cmdlet used to remove one or more owners from an application registration in Microsoft Entra ID (Azure AD). Owners are users or service principals who manage the app. This cmdlet deletes the owner reference from the application object without affecting the owner account itself.
In plain terms: it unassigns someone as an app owner.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
This cmdlet is helpful when you want to keep application ownership clean and compliant, especially at scale. Common reasons include:
Before using Remove-MgApplicationOwnerByRef, make sure:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Application.ReadWrite.All"
You’ll typically need roles like Application Administrator, Cloud Application Administrator, or Global Administrator.
You must provide:
Basic syntax:
Remove-MgApplicationOwnerByRef -ApplicationId <String> -DirectoryObjectId <String> [-Confirm]
To remove a single owner from an application, use the following command:
$applicationId = "12345678-abcd-1234-abcd-1234567890ab"
$ownerId = "87654321-dcba-4321-dcba-0987654321ba"
Remove-MgApplicationOwnerByRef -ApplicationId $applicationId -DirectoryObjectId $ownerId
If you need to remove multiple owners, you can loop through a list of owner IDs:
$applicationId = "12345678-abcd-1234-abcd-1234567890ab"
$ownerIds = @("87654321-dcba-4321-dcba-0987654321ba", "23456789-abcd-1234-abcd-1234567890cd")
foreach ($ownerId in $ownerIds) {
Remove-MgApplicationOwnerByRef -ApplicationId $applicationId -DirectoryObjectId $ownerId
}
This script loops through the array of owner IDs and removes each one from the specified application.
You can use the -Confirm parameter to prompt for confirmation before removing the owner:
$applicationId = "12345678-abcd-1234-abcd-1234567890ab"
$ownerId = "87654321-dcba-4321-dcba-0987654321ba"
Remove-MgApplicationOwnerByRef -ApplicationId $applicationId -DirectoryObjectId $ownerId -Confirm
This command will prompt you to confirm the removal action before proceeding.
| Key Point | Details |
| Cmdlet Name | Remove-MgApplicationOwnerByRef |
| Purpose | Removes an owner reference from an Entra ID application |
| Required Scope | Application.ReadWrite.All |
| Primary Parameters | ApplicationId, DirectoryObjectId |
| Automation Benefit | Enables fast, repeatable app-ownership cleanup |
| Use Case | Governance audits, offboarding, privilege reduction |
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex