New-AzSynapseRoleAssignment
Creates a Synapse Analytics role assignment.
Syntax
NewByWorkspaceNameAndNameParameterSet (Default)
New-AzSynapseRoleAssignment
-WorkspaceName <String>
-RoleDefinitionName <String>
-SignInName <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceNameAndIdParameterSet
New-AzSynapseRoleAssignment
-WorkspaceName <String>
-RoleDefinitionName <String>
-ObjectId <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet
New-AzSynapseRoleAssignment
-WorkspaceName <String>
-RoleDefinitionId <String>
-ObjectId <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceNameAndServicePrincipalNameParameterSet
New-AzSynapseRoleAssignment
-WorkspaceName <String>
-RoleDefinitionName <String>
-ServicePrincipalName <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceObjectAndNameParameterSet
New-AzSynapseRoleAssignment
-WorkspaceObject <PSSynapseWorkspace>
-RoleDefinitionName <String>
-SignInName <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceObjectAndIdParameterSet
New-AzSynapseRoleAssignment
-WorkspaceObject <PSSynapseWorkspace>
-RoleDefinitionName <String>
-ObjectId <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet
New-AzSynapseRoleAssignment
-WorkspaceObject <PSSynapseWorkspace>
-RoleDefinitionId <String>
-ObjectId <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NewByWorkspaceObjectAndServicePrincipalNameParameterSet
New-AzSynapseRoleAssignment
-WorkspaceObject <PSSynapseWorkspace>
-RoleDefinitionName <String>
-ServicePrincipalName <String>
[-ItemType <WorkspaceItemType>]
[-Item <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzSynapseRoleAssignment cmdlet creates an Azure Synapse Analytics role assignment.
The cmdlet may call below Microsoft Graph API according to input parameters:
GET /users/{id}
GET /servicePrincipals/{id}
Note
To create a role assignment for a service principal, pass the object ID of the principal in the ObjectId parameter.
When you are a user with permission to manage Azure RBAC role assignment on the workspace but not a Synapse Administrator, please create Synapse Administrator role by -RoleDefinitionId and -ObjectId directly but not by -RoleDefinitionName , for Synapse Administrator, RoleDefinitionId is "00001111-aaaa-2222-bbbb-3333cccc4444", please take below Example 5 as reference. The reason for this is , when you try to add a "Synapse Administrator" role, the cmdlet needs to get the role ID from the role name which requires workspace read permission, which the current user does not have.
Examples
Example 1
New-AzSynapseRoleAssignment -WorkspaceName ContosoWorkspace -RoleDefinitionName ContosoRole -SignInName ContosoName
This command assigns ContosoRole to the user whose principal name is ContosoName.
Example 2
New-AzSynapseRoleAssignment -WorkspaceName ContosoWorkspace -RoleDefinitionName ContosoRole -SignInName ContosoName -ItemType ContosoItemType -Item ContosoItem
This command assigns ContosoRole to the user whose principal name is ContosoName and item type is ContosoItemType, item is ContosoItem.
Example 3
New-AzSynapseRoleAssignment -WorkspaceName ContosoWorkspace -RoleDefinitionName ContosoRole -SignInName ContosoName -ItemType ContosoItemType -Item ContosoItem
This command assigns ContosoRole to the user whose principal name is ContosoName and item type is ContosoItemType, item is ContosoItem.
Example 4
$ws = Get-AzSynapseWorkspace -Name ContosoWorkspace
$ws | New-AzSynapseRoleAssignment -RoleDefinitionName ContosoRole -SignInName ContosoName
This command assigns ContosoRole to the user whose principal name is ContosoName through pipeline.
Example 5
$ws = Get-AzSynapseWorkspace -Name ContosoWorkspace
$ws | New-AzSynapseRoleAssignment -RoleDefinitionId "00001111-aaaa-2222-bbbb-3333cccc4444" -ObjectId ContosoObjectId
This command assigns Synapse Administrator role to the user whose object Id is ContosoObjectId through pipeline.
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Item
The workspace item.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ItemType
The workspace item type.
Parameter properties
Type: Microsoft.Azure.Commands.Synapse.Models.SynapseConstants+WorkspaceItemType
Default value: None
Accepted values: ApacheSparkPool, IntegrationRuntime, LinkedService, Credential
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ObjectId
The Microsoft Entra ObjectId of the User, Group or Service Principal.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Id, PrincipalId
Parameter sets
NewByWorkspaceNameAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RoleDefinitionId
Id of the Role that is assigned to the principal.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RoleDefinitionName
Name of the Role that is assigned to the principal.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NewByWorkspaceNameAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ServicePrincipalName
The ServicePrincipalName of the service principal.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NewByWorkspaceNameAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SignInName
The email address or the user principal name of the user.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Email, UserPrincipalName
Parameter sets
NewByWorkspaceNameAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WorkspaceName
Name of Synapse workspace.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NewByWorkspaceNameAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceNameAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WorkspaceObject
workspace input object, usually passed through the pipeline.
Parameter properties
Parameter sets
NewByWorkspaceObjectAndNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
NewByWorkspaceObjectAndServicePrincipalNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
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 .
Outputs