-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Synapse] Update role assignment/definition related cmdlets #17476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
38d6c61
update 'az synapse role' commands
sunsw1994 10f3a22
update recording file
sunsw1994 c401ddb
revert launch.json
sunsw1994 b5774e9
address comments
sunsw1994 a3c5667
fix pylint error
sunsw1994 4dc2a9b
1. address comments 2. remove scope parameter of az role definition d…
sunsw1994 6c3eb78
Update help text for argument
sunsw1994 bdf53ca
Update help text for argument
sunsw1994 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -858,6 +858,20 @@ | |
| short-summary: Manage Synapse's role assignments and definitions. | ||
| """ | ||
|
|
||
| helps['synapse role scope'] = """ | ||
| type: group | ||
| short-summary: Manage Synapse's role scopes. | ||
| """ | ||
|
|
||
| helps['synapse role scope list'] = """ | ||
| type: command | ||
| short-summary: List role scopes. | ||
| examples: | ||
| - name: List role scopes. | ||
| text: |- | ||
| az synapse role scope list --workspace-name testsynapseworkspace | ||
| """ | ||
|
|
||
| helps['synapse role assignment'] = """ | ||
| type: group | ||
| short-summary: Manage Synapse's role assignments. | ||
|
|
@@ -883,15 +897,23 @@ | |
| - name: List role assignments by role id/name. | ||
| text: |- | ||
| az synapse role assignment list --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" | ||
| --role "Synapse Apache Spark Administrator" | ||
| - name: List role assignments by assignee. | ||
| text: |- | ||
| az synapse role assignment list --workspace-name testsynapseworkspace \\ | ||
| --assignee sp_name | ||
| - name: List role assignments by objectId of the User, Group or Service Principal. | ||
| text: |- | ||
| az synapse role assignment list --workspace-name testsynapseworkspace \\ | ||
| --assignee 00000000-0000-0000-0000-000000000000 | ||
| --assignee-object-id 00000000-0000-0000-0000-000000000000 | ||
| - name: List role assignments by scope. | ||
| text: |- | ||
| az synapse role assignment list --workspace-name testsynapseworkspace \\ | ||
| --scope "workspaces/{workspaceName}" | ||
| - name: List role assignments by item type and item name. | ||
| text: |- | ||
| az synapse role assignment list --workspace-name testsynapseworkspace \\ | ||
| --item-type "bigDataPools" --item "bigDataPoolName" | ||
| """ | ||
|
|
||
| helps['synapse role assignment create'] = """ | ||
|
|
@@ -901,15 +923,24 @@ | |
| - name: Create a role assignment using service principal name. | ||
| text: |- | ||
| az synapse role assignment create --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" --assignee sp_name | ||
| --role "Synapse Administrator" --assignee sp_name | ||
| - name: Create a role assignment using user principal name. | ||
| text: |- | ||
| az synapse role assignment create --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" --assignee [email protected] | ||
| --role "Synapse Administrator" --assignee [email protected] | ||
| - name: Create a role assignment using objectId of the User, Group or Service Principal. | ||
| text: |- | ||
| az synapse role assignment create --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" --assignee 00000000-0000-0000-0000-000000000000 | ||
| --role "Synapse Administrator" --assignee 00000000-0000-0000-0000-000000000000 | ||
| - name: Create a role assignment at scope. | ||
| text: |- | ||
| az synapse role assignment create --workspace-name testsynapseworkspace \\ | ||
| --scope "workspaces/{workspaceName}" --role "Synapse Administrator" --assignee [email protected] | ||
| - name: Create a role assignment at scope that combination of item type and item name. | ||
| text: |- | ||
| az synapse role assignment create --workspace-name testsynapseworkspace \\ | ||
| --item-type "bigDataPools" --item "bigDataPoolName" --role "Synapse Administrator" \\ | ||
| --assignee [email protected] | ||
| """ | ||
|
|
||
| helps['synapse role assignment delete'] = """ | ||
|
|
@@ -919,11 +950,11 @@ | |
| - name: Delete role assignments by role and assignee. | ||
| text: |- | ||
| az synapse role assignment delete --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" --assignee sp_name | ||
| --role "Synapse Administrator" --assignee sp_name | ||
| - name: Delete role assignments by role id/name. | ||
| text: |- | ||
| az synapse role assignment delete --workspace-name testsynapseworkspace \\ | ||
| --role "Sql Admin" | ||
| --role "Synapse Administrator" | ||
evelyn-ys marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Delete role assignments by service principal name. | ||
| text: |- | ||
| az synapse role assignment delete --workspace-name testsynapseworkspace \\ | ||
|
|
@@ -940,6 +971,10 @@ | |
| text: |- | ||
| az synapse role assignment delete --workspace-name testsynapseworkspace \\ | ||
| --ids 10000000-0000-0000-0000-10000000-10000000-0000-0000-0000-10000000 | ||
| - name: Delete role assignments by scope. | ||
| text: |- | ||
| az synapse role assignment delete --workspace-name testsynapseworkspace \\ | ||
| --scope "workspaces/testsynapseworkspace/linkedServices/testlinkedServices" | ||
| """ | ||
|
|
||
| helps['synapse role definition'] = """ | ||
|
|
@@ -954,6 +989,9 @@ | |
| - name: List role definitions. | ||
| text: |- | ||
| az synapse role definition list --workspace-name testsynapseworkspace | ||
| - name: List role definitions built-in by Synapse. | ||
| text: |- | ||
| az synapse role definition list --workspace-name testsynapseworkspace --is-built-in True | ||
| """ | ||
|
|
||
| helps['synapse role definition show'] = """ | ||
|
|
@@ -964,6 +1002,10 @@ | |
| text: |- | ||
| az synapse role definition show --workspace-name testsynapseworkspace \\ | ||
| --role 00000000-0000-0000-0000-000000000000 | ||
| - name: Get role definition by role name. | ||
| text: |- | ||
| az synapse role definition show --workspace-name testsynapseworkspace \\ | ||
| --role "Synapse SQL Administrator" | ||
| """ | ||
|
|
||
| helps['synapse linked-service'] = """ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,8 +139,12 @@ def get_custom_sdk(custom_module, client_factory): | |
| operations_tmpl='azure.synapse.spark.operations#SparkBatchOperations.{}', | ||
| client_factory=None) | ||
|
|
||
| synapse_accesscontrol_sdk = CliCommandType( | ||
| operations_tmpl='azure.synapse.accesscontrol.operations#AccessControlClientOperationsMixin.{}', | ||
| synapse_role_assignment_sdk = CliCommandType( | ||
| operations_tmpl='azure.synapse.accesscontrol.operations#RoleAssignmentsOperations.{}', | ||
| client_factory=None) | ||
Juliehzl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| synapse_role_definitions_sdk = CliCommandType( | ||
| operations_tmpl='azure.synapse.accesscontrol.operations#RoleDefinitionsOperations.{}', | ||
| client_factory=None) | ||
|
|
||
| synapse_linked_service_sdk = CliCommandType( | ||
|
|
@@ -375,18 +379,22 @@ def get_custom_sdk(custom_module, client_factory): | |
| g.custom_command('cancel', 'cancel_spark_session_statement', confirmation=True) | ||
|
|
||
| # Data Plane Commands --Access control operations | ||
| with self.command_group('synapse role assignment', synapse_accesscontrol_sdk, | ||
| with self.command_group('synapse role assignment', synapse_role_assignment_sdk, | ||
| custom_command_type=get_custom_sdk('accesscontrol', None)) as g: | ||
| g.custom_command('create', 'create_role_assignment') | ||
| g.custom_command('list', 'list_role_assignments') | ||
| g.custom_show_command('show', 'get_role_assignment_by_id') | ||
| g.custom_command('delete', 'delete_role_assignment', confirmation=True) | ||
|
|
||
| with self.command_group('synapse role definition', synapse_accesscontrol_sdk, | ||
| with self.command_group('synapse role definition', synapse_role_definitions_sdk, | ||
| custom_command_type=get_custom_sdk('accesscontrol', None)) as g: | ||
| g.custom_command('list', 'list_role_definitions') | ||
| g.custom_show_command('show', 'get_role_definition') | ||
|
|
||
| with self.command_group('synapse role scope', synapse_role_definitions_sdk, | ||
| custom_command_type=get_custom_sdk('accesscontrol', None)) as g: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could declare your client factory here and don't need to define in every fuction. |
||
| g.custom_command('list', 'list_scopes') | ||
|
|
||
| # Data Plane Commands --Artifacts Linked service operations | ||
| with self.command_group('synapse linked-service', synapse_linked_service_sdk, | ||
| custom_command_type=get_custom_sdk('artifacts', None)) as g: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does
Sql Adminstill work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, now Synapse is using new role name.
Synapse SQL Administrator
Synapse Apache Spark Administrator
...
https://docs.microsoft.com/en-us/azure/synapse-analytics/security/synapse-workspace-synapse-rbac-roles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this way, it is breaking change to existing customers and we should try to avoid such breaking.
To not break customers, you should try to make previous definition work and add deprecation info to redirect to new definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just allow this breaking change considering that the module is still in preview? Now Synapse moves to new names, we don't want to allow the old names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding breaking change description at History Notes
[Synapse] BREAKING CHANGE: az synapse role assignment create: Role names at old version are not allowed, Sql Admin, Apache Spark Admin, Workspace Admin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. According to the telemetry, there is no much usage for this command as it is in preview. So we could accept the breaking change this time. Please note that we need to avoid breaking change as possible as we can in future design.