Add-EntraServicePrincipalOwner
Adds an owner to a service principal.
Syntax
Add-EntraServicePrincipalOwner
-ServicePrincipalId <String>
-RefObjectId <String>
[<CommonParameters>]
Description
The Add-EntraServicePrincipalOwner
cmdlet adds an owner to a service principal in Microsoft Entra ID.
Examples
Example 1: Add a user as an owner to a service principal
Connect-Entra -Scopes 'Application.ReadWrite.All','Application.ReadWrite.OwnedBy'
$servicePrincipal = Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
$owner = Get-EntraUser -UserId 'SawyerM@contoso.com'
Add-EntraServicePrincipalOwner -ServicePrincipalId $servicePrincipal.Id -RefObjectId $owner.Id
This example demonstrates how to add an owner to a service principal.
-ServicePrincipalId
parameter specifies the service principal ID.-RefObjectId
parameter specifies the user object ID.
Parameters
-RefObjectId
Specifies the ID of the Microsoft Entra ID object to assign as owner/manager/member.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServicePrincipalId
Specifies the ID of a service principal in Microsoft Entra ID.
Type: | System.String |
Aliases: | ObjectId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |