Set-AdminPowerAppEnvironmentRoleAssignment

Sets permissions to an environment without a Dataverse database. If you make this call to an environment with a Dataverse database instance, you receive a 403 Forbidden error.

Syntax

Set-AdminPowerAppEnvironmentRoleAssignment
   -EnvironmentName <String>
   -RoleName <String>
   -PrincipalType <String>
   -PrincipalObjectId <String>
   [-ApiVersion <String>]
   [<CommonParameters>]
Set-AdminPowerAppEnvironmentRoleAssignment
   -EnvironmentName <String>
   -RoleName <String>
   -PrincipalType <String>
   [-PrincipalObjectId <String>]
   [-ApiVersion <String>]
   [<CommonParameters>]

Description

The Set-AdminPowerAppEnvironmentRoleAssignment cmdlet grants security role permission, either environment admin or environment maker, for a single user, a security group, or all users in the tenant, for an environment. Use Get-Help Set-AdminPowerAppEnvironmentRoleAssignment -Examples for more detail.

Examples

EXAMPLE 1

Set-AdminPowerAppEnvironmentRoleAssignment -EnvironmentName 3c2f7648-ad60-4871-91cb-b77d7ef3c239 -RoleName EnvironmentAdmin -PrincipalType User -PrincipalObjectId 53c0a918-ce7c-401e-98f9-1c60b3a723b3

Assigns the environment admin role privileges to the the user with an object id of 53c0a918-ce7c-401e-98f9-1c60b3a723b3 in the environment 3c2f7648-ad60-4871-91cb-b77d7ef3c239.

EXAMPLE 2

Set-AdminPowerAppEnvironmentRoleAssignment -EnvironmentName 3c2f7648-ad60-4871-91cb-b77d7ef3c239 -RoleName EnvironmentMaker -PrincipalType Tenant

Assigns everyone environment maker role privileges in the environment 3c2f7648-ad60-4871-91cb-b77d7ef3c239.

Parameters

-ApiVersion

Specifies the Api version that is called.

Type:String
Position:Named
Default value:2016-11-01
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnvironmentName

The environment ID.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PrincipalObjectId

If this environment is being shared with a user or security group principal, this field specified the ObjectId for that principal. Use the Get-UsersOrGroupsFromGraph cmdlet to look-up the ObjectId for a user or group in Microsoft Entra ID.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PrincipalType

Specifies the type of principal this environment is being shared with; a user, a security group, or the entire tenant.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RoleName

Specifies the permission level given to the environment: environment admin or environment maker.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False