Add-EntraBetaServicePrincipalPolicy
Adds a servicePrincipal policy.
Syntax
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
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RefObjectId
Specifies the object Id of the policy.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |