Edit

Share via


Add-EntraBetaServicePrincipalPolicy

Adds a servicePrincipal policy.

Syntax

Default (Default)

Add-EntraBetaServicePrincipalPolicy

    -Id <String>
    -RefObjectId <String>
    [<CommonParameters>]

Description

The Add-EntraBetaServicePrincipalPolicy cmdlet adds a service principal policy. Specify the Id and PolicyId parameter to add a specific servicePrincipal policy.

Examples

Example 1: Add a service principal policy

Connect-Entra -Scopes 'Policy.Read.All, Application.ReadWrite.All'
$params = @{
    Id = 'bbbbbbbb-1111-1111-1111-cccccccccccc'
    RefObjectId = 'ffffffff-5555-6666-7777-aaaaaaaaaaaa'
}
Add-EntraBetaServicePrincipalPolicy @params

This example demonstrates how to add a policy to a service principal in Microsoft Entra ID.

Parameters

-Id

The ID of the Service Principal for which you need to set the policy

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-RefObjectId

Specifies the object Id of the policy.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.