New-MgApplicationOwnerByRef is a Microsoft Graph PowerShell cmdlet used to assign one or more owners to an existing app registration (application) in Microsoft Entra ID. Instead of updating the whole application object, this cmdlet adds a reference to a user or service principal as an owner.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
Administrators use this cmdlet to automate owner management for app registrations, especially in enterprise environments where apps are created and governed at scale. It helps you:
Before running the cmdlet:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Application.ReadWrite.All"
Basic syntax:
New-MgApplicationOwnerByRef -ApplicationId <String> -BodyParameter <Hashtable>
To assign a single owner to an application, you need to provide the Application ID and the User ID of the new owner. The User ID must be passed in the correct URL format.
$NewOwner = @{
"@odata.id"= "https://graph.microsoft.com/v1.0/directoryObjects/075b32dd-edb7-47cf-89ef-f3f733683a3f"
}
New-MgApplicationOwnerByRef -ApplicationId "1a2b3c4d-5678-90ab-cdef-1234567890ab" -BodyParameter $NewOwner
You can also assign multiple owners by importing User IDs from a CSV file and iterating over each ID.
Sample CSV File (Owners.csv):
UserId
075b32dd-edb7-47cf-89ef-f3f733683a3f
12345678-1234-1234-1234-1234567890ab
PowerShell Script:
$ApplicationId = "1a2b3c4d-5678-90ab-cdef-1234567890ab"
$Owners = Import-Csv -Path "C:\Path\To\Owners.csv"
foreach ($Owner in $Owners) {
$NewOwner = @{
"@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$($Owner.UserId)"
}
New-MgApplicationOwnerByRef -ApplicationId $ApplicationId -BodyParameter $NewOwner
}
| Key Point | Details |
| Cmdlet Name | New-MgApplicationOwnerByRef |
| Purpose | Adds one or more owners to an existing app registration in Microsoft Entra ID |
| Required Scope | Application.ReadWrite.All |
| Primary Parameters | ApplicationId, BodyParameter |
| Input Format | Owner must be passed using @odata.id reference URL |
| Automation Benefit | Enables bulk, scripted ownership assignment for governance and CI/CD setups |
| Common Use Case | Assigning app owners during automated app registration or compliance audits |
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