From a5c7174894504fc5652d47664b67a8bdecb3e757 Mon Sep 17 00:00:00 2001 From: kevinzz6 <632604666@qq.com> Date: Fri, 28 Oct 2022 10:04:29 +0800 Subject: [PATCH] [Synapse] `az synapse workspace create`: Add parameter `--managed-resource-group-name` (#23713) --- linter_exclusions.yml | 2 +- .../azure/cli/command_modules/synapse/manual/_help.py | 6 ++++++ .../azure/cli/command_modules/synapse/manual/_params.py | 2 ++ .../command_modules/synapse/manual/operations/workspace.py | 6 ++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/linter_exclusions.yml b/linter_exclusions.yml index f1a2e07b68c..db85826dbc2 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -3944,4 +3944,4 @@ webapp update: - option_length_too_long skip_dns_registration: rule_exclusions: - - option_length_too_long + - option_length_too_long \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/synapse/manual/_help.py b/src/azure-cli/azure/cli/command_modules/synapse/manual/_help.py index 117584eaad3..b246137d25d 100644 --- a/src/azure-cli/azure/cli/command_modules/synapse/manual/_help.py +++ b/src/azure-cli/azure/cli/command_modules/synapse/manual/_help.py @@ -45,6 +45,12 @@ --sql-admin-login-user cliuser1 --sql-admin-login-password Password123! --location "East US" \\ --repository-type AzureDevOpsGit --account-name testuser --project-name testprj \\ --repository-name testrepo --collaboration-branch main --last-commit-id 000000 + - name: Create a Synapse workspace with managed resource group + text: |- + az synapse workspace create --name testworkspace --resource-group rg \\ + --managed-rg-name managedrg \\ + --storage-account testadlsgen2 --file-system testfilesystem \\ + --sql-admin-login-user cliuser1 --sql-admin-login-password Password123! --location "East US" """ helps['synapse workspace list'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py index ddfc1fc680a..0b9c07551ff 100644 --- a/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py +++ b/src/azure-cli/azure/cli/command_modules/synapse/manual/_params.py @@ -117,6 +117,8 @@ def load_arguments(self, _): c.argument('prevent_data_exfiltration', arg_type=get_three_state_flag(), help='The flag indicates whether enable data exfiltration.', options_list=['--prevent-exfiltration', '--prevent-data-exfiltration']) c.argument('key_identifier', help='The customer-managed key used to encrypt all data at rest in the workspace. Key identifier should be in the format of: https://{keyvaultname}.vault.azure.net/keys/{keyname}.', options_list=['--key-identifier', '--cmk']) + c.argument('managed_resource_group_name', options_list=['--managed-rg-name'], + help=' Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId.') with self.argument_context('synapse workspace check-name') as c: c.argument('name', arg_type=name_type, help='The name you wanted to check.') diff --git a/src/azure-cli/azure/cli/command_modules/synapse/manual/operations/workspace.py b/src/azure-cli/azure/cli/command_modules/synapse/manual/operations/workspace.py index 1ddb7b7e4e9..e13a1a3c8d8 100644 --- a/src/azure-cli/azure/cli/command_modules/synapse/manual/operations/workspace.py +++ b/src/azure-cli/azure/cli/command_modules/synapse/manual/operations/workspace.py @@ -20,7 +20,8 @@ def list_workspaces(cmd, client, resource_group_name=None): def create_workspace(cmd, client, resource_group_name, workspace_name, storage_account, file_system, sql_admin_login_user, sql_admin_login_password, location=None, key_name="default", key_identifier=None, enable_managed_virtual_network=None, allowed_aad_tenant_ids=None, prevent_data_exfiltration=None, tags=None, repository_type=None, host_name=None, account_name=None, - collaboration_branch=None, repository_name=None, root_folder='/', project_name=None, last_commit_id=None, tenant_id=None, no_wait=False): + collaboration_branch=None, repository_name=None, root_folder='/', project_name=None, last_commit_id=None, tenant_id=None, + managed_resource_group_name=None, no_wait=False): identity_type = "SystemAssigned" identity = ManagedIdentity(type=identity_type) account_url = "https://{}.dfs.{}".format(storage_account, cmd.cli_ctx.cloud.suffixes.storage_endpoint) @@ -77,7 +78,8 @@ def create_workspace(cmd, client, resource_group_name, workspace_name, storage_a managed_virtual_network_settings=managed_virtual_network_settings, encryption=encryption, tags=tags, - workspace_repository_configuration=workspace_repository_configuration + workspace_repository_configuration=workspace_repository_configuration, + managed_resource_group_name=managed_resource_group_name ) return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, workspace_name, workspace_info)