Skip to content

Commit 0339bf2

Browse files
zesluo1VeryEarly
andauthored
Remove principaltype in Synapse Role-based access control (#14767)
* update changelog7 * remove principal type * update change log * improve changelog * skipbreakingchanges * Update ChangeLog.md Co-authored-by: Yabo Hu <[email protected]>
1 parent 84dc422 commit 0339bf2

File tree

9 files changed

+32
-78
lines changed

9 files changed

+32
-78
lines changed

src/Synapse/Synapse/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Removed principaltype in Synapse Role-based access control
2122

2223
## Version 0.10.0
2324
* Add support for Synapse Role-based access control

src/Synapse/Synapse/Commands/DataPlaneCommands/AccessControl/NewAzureSynapseRoleAssignment.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ public class NewAzureSynapseRoleAssignment : SynapseRoleCmdletBase
106106
[ValidateNotNullOrEmpty]
107107
public string Item { get; set; }
108108

109-
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false, HelpMessage = HelpMessages.WorkspacePrincipalType)]
110-
[ValidateNotNullOrEmpty]
111-
public PrincipalType PrincipalType { get; set; }
112-
113109
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
114110
public SwitchParameter AsJob { get; set; }
115111

@@ -141,12 +137,6 @@ public override void ExecuteCmdlet()
141137
itemType = this.ItemType.GetItemTypeString();
142138
}
143139

144-
string principalType = null;
145-
if (this.IsParameterBound(c => c.PrincipalType))
146-
{
147-
principalType = this.PrincipalType.GetPrincipalTypeString();
148-
}
149-
150140
if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.CreatingSynapseRoleAssignment, this.WorkspaceName, this.RoleDefinitionId, this.ObjectId)))
151141
{
152142
// Item type and item should appear Report error if either item type or item is specified.
@@ -158,7 +148,7 @@ public override void ExecuteCmdlet()
158148

159149
string roleAssignmentId = Guid.NewGuid().ToString();
160150
string scope = SynapseAnalyticsClient.GetRoleAssignmentScope(this.WorkspaceName, itemType, this.Item);
161-
PSRoleAssignmentDetails roleAssignmentDetails = new PSRoleAssignmentDetails(SynapseAnalyticsClient.CreateRoleAssignment(roleAssignmentId, this.RoleDefinitionId, this.ObjectId, scope, principalType));
151+
PSRoleAssignmentDetails roleAssignmentDetails = new PSRoleAssignmentDetails(SynapseAnalyticsClient.CreateRoleAssignment(roleAssignmentId, this.RoleDefinitionId, this.ObjectId, scope));
162152
WriteObject(roleAssignmentDetails);
163153
}
164154
}

src/Synapse/Synapse/Common/HelpMessages.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,6 @@ SELECT on dbo.myTable by public
421421

422422
public const string WorkspaceItem = "The workspace item.";
423423

424-
public const string WorkspacePrincipalType = "The workspace principal type.";
425-
426424
public const string IsActiveCustomerManagedKey = "Indicates whether to activate the workspace after a customer managed key is provided.";
427425

428426
public const string KeyResourceId = "The resource identifier of Synapse SQL Pool.";

src/Synapse/Synapse/Common/Utils.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -220,24 +220,5 @@ public static string GetItemTypeString(this WorkspaceItemType itemType)
220220

221221
return itemTypeString;
222222
}
223-
224-
public static string GetPrincipalTypeString(this PrincipalType principalType)
225-
{
226-
string principalTypeString = null;
227-
switch (principalType)
228-
{
229-
case PrincipalType.User:
230-
principalTypeString = "User";
231-
break;
232-
case PrincipalType.Group:
233-
principalTypeString = "Group";
234-
break;
235-
case PrincipalType.ServicePrincipal:
236-
principalTypeString = "ServicePrincipal";
237-
break;
238-
}
239-
240-
return principalTypeString;
241-
}
242223
}
243224
}

src/Synapse/Synapse/Models/SynapseAnalyticsRoleClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public RoleAssignmentDetails GetRoleAssignmentById(string roleAssignmentId)
4343
return _roleAssignmentsClient.GetRoleAssignmentById(roleAssignmentId);
4444
}
4545

46-
public RoleAssignmentDetails CreateRoleAssignment(string roleAssignmentId, string roleDefinitionId, string objectId, string scope, string principalType)
46+
public RoleAssignmentDetails CreateRoleAssignment(string roleAssignmentId, string roleDefinitionId, string objectId, string scope)
4747
{
48-
return _roleAssignmentsClient.CreateRoleAssignment(roleAssignmentId, new Guid(roleDefinitionId), new Guid(objectId), scope, principalType);
48+
return _roleAssignmentsClient.CreateRoleAssignment(roleAssignmentId, new Guid(roleDefinitionId), new Guid(objectId), scope);
4949
}
5050

5151
public void DeleteRoleAssignmentById(string roleAssignmentId)

src/Synapse/Synapse/Models/SynapseConstants.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,5 @@ public enum WorkspaceItemType
235235
LinkedService,
236236
Credential
237237
}
238-
239-
public enum PrincipalType
240-
{
241-
User,
242-
Group,
243-
ServicePrincipal
244-
}
245238
}
246239
}

src/Synapse/Synapse/help/New-AzSynapseRoleAssignment.md

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,57 @@ Creates a Synapse Analytics role assignment.
1515
### NewByWorkspaceNameAndNameParameterSet (Default)
1616
```
1717
New-AzSynapseRoleAssignment -WorkspaceName <String> -RoleDefinitionName <String> -SignInName <String>
18-
[-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
19-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
18+
[-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
19+
[-Confirm] [<CommonParameters>]
2020
```
2121

2222
### NewByWorkspaceNameAndIdParameterSet
2323
```
2424
New-AzSynapseRoleAssignment -WorkspaceName <String> -RoleDefinitionName <String> -ObjectId <String>
25-
[-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
26-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
25+
[-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
26+
[-Confirm] [<CommonParameters>]
2727
```
2828

2929
### NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet
3030
```
3131
New-AzSynapseRoleAssignment -WorkspaceName <String> -RoleDefinitionId <String> -ObjectId <String>
32-
[-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
33-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
32+
[-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
33+
[-Confirm] [<CommonParameters>]
3434
```
3535

3636
### NewByWorkspaceNameAndServicePrincipalNameParameterSet
3737
```
3838
New-AzSynapseRoleAssignment -WorkspaceName <String> -RoleDefinitionName <String> -ServicePrincipalName <String>
39-
[-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
40-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
39+
[-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
40+
[-Confirm] [<CommonParameters>]
4141
```
4242

4343
### NewByWorkspaceObjectAndNameParameterSet
4444
```
4545
New-AzSynapseRoleAssignment -WorkspaceObject <PSSynapseWorkspace> -RoleDefinitionName <String>
46-
-SignInName <String> [-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>]
47-
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
46+
-SignInName <String> [-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob]
47+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
4848
```
4949

5050
### NewByWorkspaceObjectAndIdParameterSet
5151
```
5252
New-AzSynapseRoleAssignment -WorkspaceObject <PSSynapseWorkspace> -RoleDefinitionName <String>
53-
-ObjectId <String> [-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
53+
-ObjectId <String> [-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob]
5454
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
5555
```
5656

5757
### NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet
5858
```
5959
New-AzSynapseRoleAssignment -WorkspaceObject <PSSynapseWorkspace> -RoleDefinitionId <String> -ObjectId <String>
60-
[-ItemType <WorkspaceItemType>] [-Item <String>] [-PrincipalType <PrincipalType>] [-AsJob]
61-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
60+
[-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
61+
[-Confirm] [<CommonParameters>]
6262
```
6363

6464
### NewByWorkspaceObjectAndServicePrincipalNameParameterSet
6565
```
6666
New-AzSynapseRoleAssignment -WorkspaceObject <PSSynapseWorkspace> -RoleDefinitionName <String>
67-
-ServicePrincipalName <String> [-ItemType <WorkspaceItemType>] [-Item <String>]
68-
[-PrincipalType <PrincipalType>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
69-
[<CommonParameters>]
67+
-ServicePrincipalName <String> [-ItemType <WorkspaceItemType>] [-Item <String>] [-AsJob]
68+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
7069
```
7170

7271
## DESCRIPTION
@@ -90,10 +89,10 @@ This command assigns ContosoRole to the user whose principal name is ContosoName
9089

9190
### Example 3
9291
```powershell
93-
PS C:\> New-AzSynapseRoleAssignment -WorkspaceName ContosoWorkspace -RoleDefinitionName ContosoRole -SignInName ContosoName -ItemType ContosoItemType -Item ContosoItem -PrincipalType ContosoPrincipalType
92+
PS C:\> New-AzSynapseRoleAssignment -WorkspaceName ContosoWorkspace -RoleDefinitionName ContosoRole -SignInName ContosoName -ItemType ContosoItemType -Item ContosoItem
9493
```
9594

96-
This command assigns ContosoRole to the user whose principal name is ContosoName and item type is ContosoItemType, item is ContosoItem, principal type is ContosoPrincipalType.
95+
This command assigns ContosoRole to the user whose principal name is ContosoName and item type is ContosoItemType, item is ContosoItem.
9796

9897
### Example 4
9998
```powershell
@@ -181,22 +180,6 @@ Accept pipeline input: False
181180
Accept wildcard characters: False
182181
```
183182
184-
### -PrincipalType
185-
The workspace principal type.
186-
187-
```yaml
188-
Type: Microsoft.Azure.Commands.Synapse.Models.SynapseConstants+PrincipalType
189-
Parameter Sets: (All)
190-
Aliases:
191-
Accepted values: User, Group, ServicePrincipal
192-
193-
Required: False
194-
Position: Named
195-
Default value: None
196-
Accept pipeline input: False
197-
Accept wildcard characters: False
198-
```
199-
200183
### -RoleDefinitionId
201184
Id of the Role that is assigned to the principal.
202185

src/Synapse/Synapse/help/Remove-AzSynapseRoleAssignment.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,5 +358,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
358358
## NOTES
359359
360360
## RELATED LINKS
361-
362-
## RELATED LINKS

tools/StaticAnalysis/Exceptions/Az.Synapse/BreakingChangeIssues.csv

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,14 @@
4747
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synaspe.NewAzureSynapseWorkspace","New-AzSynapseWorkspace","0","2020","The cmdlet 'New-AzSynapseWorkspace' no longer supports the type 'System.String' for parameter 'ManagedVirtualNetwork'.","Change the type for parameter 'ManagedVirtualNetwork' back to 'System.String'."
4848
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseFirewallRule","New-AzSynapseFirewallRule","0","2000","The cmdlet 'New-AzSynapseFirewallRule' no longer supports the parameter 'AllowAllAzureIP' and no alias was found for the original parameter name.","Add the parameter 'AllowAllAzureIP' back to the cmdlet 'New-AzSynapseFirewallRule', or add an alias to the original parameter name."
4949
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseFirewallRule","New-AzSynapseFirewallRule","0","1050","The parameter set 'CreateByNameAllowAllIpParameterSet' for cmdlet 'New-AzSynapseFirewallRule' has been removed.","Add parameter set 'CreateByNameAllowAllIpParameterSet' back to cmdlet 'New-AzSynapseFirewallRule'."
50-
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseFirewallRule","New-AzSynapseFirewallRule","0","1050","The parameter set 'CreateByParentObjectAllowAllIpParameterSet' for cmdlet 'New-AzSynapseFirewallRule' has been removed.","Add parameter set 'CreateByParentObjectAllowAllIpParameterSet' back to cmdlet 'New-AzSynapseFirewallRule'."
50+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseFirewallRule","New-AzSynapseFirewallRule","0","1050","The parameter set 'CreateByParentObjectAllowAllIpParameterSet' for cmdlet 'New-AzSynapseFirewallRule' has been removed.","Add parameter set 'CreateByParentObjectAllowAllIpParameterSet' back to cmdlet 'New-AzSynapseFirewallRule'."
51+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","2000","The cmdlet 'New-AzSynapseRoleAssignment' no longer supports the parameter 'PrincipalType' and no alias was found for the original parameter name.","Add the parameter 'PrincipalType' back to the cmdlet 'New-AzSynapseRoleAssignment', or add an alias to the original parameter name."
52+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceNameAndNameParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceNameAndNameParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
53+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceNameAndIdParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceNameAndIdParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
54+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceNameAndRoleDefinitionIdAndObjectIdParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
55+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceNameAndServicePrincipalNameParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceNameAndServicePrincipalNameParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
56+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceObjectAndNameParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceObjectAndNameParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
57+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceObjectAndIdParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceObjectAndIdParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
58+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceObjectAndRoleDefinitionIdAndObjectIdParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
59+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set 'NewByWorkspaceObjectAndServicePrincipalNameParameterSet' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set 'NewByWorkspaceObjectAndServicePrincipalNameParameterSet' back to cmdlet 'New-AzSynapseRoleAssignment'."
60+
"Microsoft.Azure.PowerShell.Cmdlets.Synapse.dll","Microsoft.Azure.Commands.Synapse.NewAzureSynapseRoleAssignment","New-AzSynapseRoleAssignment","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzSynapseRoleAssignment' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzSynapseRoleAssignment'."

0 commit comments

Comments
 (0)