Skip to content

[Synapse] Add new cmdlets for synapse sql aad admin and sql audit policy and add update cmdlet for synapse workspace firewall rule#16241

Merged
jsntcy merged 29 commits intoAzure:devfrom
aim-for-better:SynapseSQLDWBatch2
Dec 23, 2020
Merged

[Synapse] Add new cmdlets for synapse sql aad admin and sql audit policy and add update cmdlet for synapse workspace firewall rule#16241
jsntcy merged 29 commits intoAzure:devfrom
aim-for-better:SynapseSQLDWBatch2

Conversation

@aim-for-better
Copy link
Copy Markdown
Member

@aim-for-better aim-for-better commented Dec 11, 2020

Description

  1. Add new cmdlets az synapse sql ad-admin show, create, update, delete
  2. Add new cmdlet az synapse workspace firewall-rule update
  3. Add new cmdlets az synapse sql audit-policy show, update

Testing Guide

History Notes

[Synapse] 1. Add new cmdlets az synapse sql ad-admin show, create, update, delete
2. Add new cmdlet az synapse workspace firewall-rule update
3. Add new cmdlets az synapse sql audit-policy show, update


This checklist is used to make sure that common guidelines for a pull request are followed.

dkmiller and others added 22 commits April 27, 2020 16:13
Support az synapse sql ad-admin create, update, delete, show
Support az synapse workspace firewall-rule update
Support az synapse sql audit-policy show, update
@aim-for-better aim-for-better added this to the S180 milestone Dec 11, 2020
@aim-for-better aim-for-better changed the title [Synapse] Support SQL DW cmdlet batch2 [Synapse] Add new cmdlets for synapse sql aad admin and sql audit policy and add update cmdlet for synapse workspace firewall rule Dec 11, 2020
@aim-for-better
Copy link
Copy Markdown
Member Author

Is the linter rule "MEDIUM severity: no_required_location_param" new added?

Comment on lines +99 to +107
def _validate_audit_policy_arguments(state=None, storage_account=None, storage_endpoint=None,
storage_account_access_key=None, retention_days=None):
blob_storage_arguments_provided = any(
[storage_account, storage_endpoint, storage_account_access_key, retention_days])
if not state and not blob_storage_arguments_provided:
raise CLIError('Either state or blob storage arguments are missing')

if retention_days is not None and (not retention_days.isdigit() or int(retention_days) <= 0):
raise CLIError('retention-days must be a positive number greater than zero')
Copy link
Copy Markdown
Contributor

@Juliehzl Juliehzl Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such validation would be recommended to add as validator and other commands/parameters could utilize the function.
see https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/storage/_params.py#L351

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such validation would be recommended to add as validator and other commands/parameters could utilize the function.
see https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/storage/_params.py#L351

Hi @Juliehzl , thanks for your comment, I have removed the validation for retention_days. I agree with you, but per my understanding, the validator need to bind with one parameter which means one validator for one parameter, how should we validate multiple parameters in validator?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Juliehzl , for this comments, could you please give some suggestions? Thanks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved this function to _validators.py and add validator in command level. Thanks for this comments, it is my first time to know that we can add validator in command level.

@aim-for-better
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@aim-for-better
Copy link
Copy Markdown
Member Author

Hi @jsntcy Could you please help review this PR? It is almost 5 work days. We hope we can catch S180. Thank you very much~

@aim-for-better
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@aim-for-better
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Comment on lines +232 to +233
g.show_command('show', 'get')
g.generic_update_command('update', custom_func_name='sqlserver_blob_auditing_policy_update')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only two commands for audit-policy? What about delete, create, list?

Copy link
Copy Markdown
Member Author

@aim-for-better aim-for-better Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we just to keep consistent with az sql server. And I checked for az synapse sql audit-policy the dependent api is a long running, but for az synapse sql pool audit-policy the dependent api is not long running.
I have add wait command and add suppport_no_wait=True for this comments.

Comment on lines +393 to +399
self.cmd('az synapse sql audit-policy update --state Enabled --storage-account {storage-account} '
'--workspace-name {workspace} --resource-group {rg}')

self.cmd('az synapse sql audit-policy show --workspace-name {workspace} --resource-group {rg}',
checks=[
self.check('state', 'Enabled')
])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. could we also check the update command?
  2. could we get first, update and then get again to see the value change?
  3. please add update for all parameters.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. could we also check the update command?
  2. could we get first, update and then get again to see the value change?
  3. please add update for all parameters.

Thanks, I have updated the test for az synapse sql audit-policy and az synapse sql pool audit-policy

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Dec 21, 2020

Please address the comments raised by @Juliehzl before merging this PR.

@aim-for-better
Copy link
Copy Markdown
Member Author

Please address the comments raised by @Juliehzl before merging this PR.

Sure. Thanks

@jsntcy jsntcy merged commit 94dcc6a into Azure:dev Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants