From 36b820fa87a8af554e9ee79de5e0c435e0e0fb38 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Tue, 14 Mar 2017 13:56:15 -0700 Subject: [PATCH 01/19] Update python sdk dependency --- src/command_modules/azure-cli-sql/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command_modules/azure-cli-sql/setup.py b/src/command_modules/azure-cli-sql/setup.py index 515833d79a7..9d4387544e8 100644 --- a/src/command_modules/azure-cli-sql/setup.py +++ b/src/command_modules/azure-cli-sql/setup.py @@ -24,7 +24,7 @@ DEPENDENCIES = [ 'azure-cli-core', - 'azure-mgmt-sql==0.3.1', + 'azure-mgmt-sql==0.3.3', 'six' ] From 20adafd22976c947b07c8c37083781b428490f68 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Tue, 14 Mar 2017 14:14:13 -0700 Subject: [PATCH 02/19] Added db audit & td policy show & update --- .../azure/cli/command_modules/sql/_util.py | 8 +++++ .../azure/cli/command_modules/sql/commands.py | 32 +++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py index becc4e96389..d3996aa6c14 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py @@ -32,6 +32,14 @@ def get_sql_recommended_elastic_pools_operations(kwargs): return get_sql_management_client(kwargs).recommended_elastic_pools +def get_sql_database_blob_auditing_policies_operations(kwargs): + return get_sql_management_client(kwargs).database_blob_auditing_policies + + +def get_sql_database_threat_detection_policies_operations(kwargs): + return get_sql_management_client(kwargs).database_threat_detection_policies + + # COMMANDS UTILITIES def create_service_adapter(service_model, service_class): diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py index b56c5410afc..7c060c1753a 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py @@ -3,8 +3,14 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from ._util import (get_sql_servers_operation, get_sql_database_operations, - get_sql_elasticpools_operations, create_service_adapter, ServiceGroup) +from ._util import ( + get_sql_servers_operation, + get_sql_database_operations, + get_sql_database_blob_auditing_policies_operations, + get_sql_database_threat_detection_policies_operations, + get_sql_elasticpools_operations, + create_service_adapter, + ServiceGroup) ############################################### # sql db # @@ -57,6 +63,28 @@ # c.command('list', 'list_service_tier_advisors') # c.command('show', 'get_service_tier_advisor') +database_blob_auditing_policy_operations = create_service_adapter( + 'azure.mgmt.sql.operations.database_blob_auditing_policies_operations', + 'DatabaseBlobAuditingPoliciesOperations') + +with ServiceGroup(__name__, + get_sql_database_blob_auditing_policies_operations, + database_blob_auditing_policy_operations) as s: + with s.group('sql db audit-policy') as c: + c.command('show', 'get') + c.generic_update_command('update', 'get', 'create_or_update') + +database_threat_detection_policy_operations = create_service_adapter( + 'azure.mgmt.sql.operations.database_threat_detection_policies_operations', + 'DatabaseThreatDetectionPoliciesOperations') + +with ServiceGroup(__name__, + get_sql_database_threat_detection_policies_operations, + database_threat_detection_policy_operations) as s: + with s.group('sql db threat-detection-policy') as c: + c.command('show', 'get') + c.generic_update_command('update', 'get', 'create_or_update') + ############################################### # sql elastic-pool # ############################################### From 5a474f557444e2f59609b2ea40c90cc6109b3e4e Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 10:51:30 -0700 Subject: [PATCH 03/19] Handle newly visible database properties --- .../azure-cli-sql/azure/cli/command_modules/sql/_util.py | 2 +- .../azure/cli/command_modules/sql/commands.py | 4 ++-- .../azure-cli-sql/azure/cli/command_modules/sql/params.py | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py index d3996aa6c14..e9da60b1617 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py @@ -38,7 +38,7 @@ def get_sql_database_blob_auditing_policies_operations(kwargs): def get_sql_database_threat_detection_policies_operations(kwargs): return get_sql_management_client(kwargs).database_threat_detection_policies - + # COMMANDS UTILITIES diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py index 7c060c1753a..3507592e8d4 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py @@ -67,7 +67,7 @@ 'azure.mgmt.sql.operations.database_blob_auditing_policies_operations', 'DatabaseBlobAuditingPoliciesOperations') -with ServiceGroup(__name__, +with ServiceGroup(__name__, get_sql_database_blob_auditing_policies_operations, database_blob_auditing_policy_operations) as s: with s.group('sql db audit-policy') as c: @@ -78,7 +78,7 @@ 'azure.mgmt.sql.operations.database_threat_detection_policies_operations', 'DatabaseThreatDetectionPoliciesOperations') -with ServiceGroup(__name__, +with ServiceGroup(__name__, get_sql_database_threat_detection_policies_operations, database_threat_detection_policy_operations) as s: with s.group('sql db threat-detection-policy') as c: diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 35698eff0bc..7ae2e61af5b 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -131,6 +131,9 @@ def _configure_db_create_params( if create_mode not in [CreateMode.restore, CreateMode.point_in_time_restore]: cmd.ignore('restore_point_in_time') + # Only applicable to restore create mode. However using this from CLI isn't tested yet. + cmd.ignore('source_database_deletion_date') + # 'collation', 'edition', and 'max_size_bytes' are ignored (or rejected) when creating a copy # or secondary because their values are determined by the source db. if create_mode in [CreateMode.copy, CreateMode.non_readable_secondary, @@ -152,6 +155,10 @@ def _configure_db_create_params( # Edition is always 'DataWarehouse' c.ignore('edition') + # recovery_services_recovery_point_resource_id is only for long-term-retention restore + if create_mode != CreateMode.restore_long_term_retention_backup: + c.ignore('recovery_services_recovery_point_resource_id') + with ParametersContext(command='sql db') as c: c.argument('database_name', From b389db1cda7bfcdc3b5e3b4c83c6ffa8966ac265 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 18:11:11 -0700 Subject: [PATCH 04/19] Implement security test --- .../azure/cli/command_modules/sql/_util.py | 5 +- .../azure/cli/command_modules/sql/commands.py | 9 +- .../azure/cli/command_modules/sql/custom.py | 18 + .../azure/cli/command_modules/sql/help.py | 16 + .../azure/cli/command_modules/sql/params.py | 14 +- .../recordings/test_sql_db_security_mgmt.yaml | 625 ++++++++++++++++++ .../azure-cli-sql/tests/test_sql_commands.py | 80 ++- 7 files changed, 754 insertions(+), 13 deletions(-) create mode 100644 src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py index e9da60b1617..3b00aeca6c7 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py @@ -92,7 +92,7 @@ def custom_command(self, name, custom_func_name): self._custom_path.format(custom_func_name), client_factory=self._client_factory) - def generic_update_command(self, name, getter_op, setter_op, custom_func_name=None): + def generic_update_command(self, name, getter_op, setter_op, custom_func_name=None, **kwargs): if custom_func_name: custom_function_op = self._custom_path.format(custom_func_name) else: @@ -104,7 +104,8 @@ def generic_update_command(self, name, getter_op, setter_op, custom_func_name=No self._service_adapter(getter_op), self._service_adapter(setter_op), factory=self._client_factory, - custom_function_op=custom_function_op) + custom_function_op=custom_function_op, + **kwargs) # PARAMETERS UTILITIES diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py index 3507592e8d4..850ce5462d5 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py @@ -72,7 +72,10 @@ database_blob_auditing_policy_operations) as s: with s.group('sql db audit-policy') as c: c.command('show', 'get') - c.generic_update_command('update', 'get', 'create_or_update') + c.generic_update_command( + 'update', 'get', 'create_or_update', + custom_func_name='db_audit_policy_update', + setter_arg_name='database_blob_auditing_policy') database_threat_detection_policy_operations = create_service_adapter( 'azure.mgmt.sql.operations.database_threat_detection_policies_operations', @@ -83,7 +86,9 @@ database_threat_detection_policy_operations) as s: with s.group('sql db threat-detection-policy') as c: c.command('show', 'get') - c.generic_update_command('update', 'get', 'create_or_update') + c.generic_update_command('update', 'get', 'create_or_update', + custom_func_name='db_threat_detection_policy_update', + setter_arg_name='database_security_alert_policy') ############################################### # sql elastic-pool # diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index bd3cb8994b0..bcbc93ff38e 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -331,6 +331,24 @@ def db_update( return instance +def db_audit_policy_update( + instance, + storage_account_access_key=None): + + instance.storage_account_access_key = storage_account_access_key or instance.storage_account_access_key + + return instance + + +def db_threat_detection_policy_update( + instance, + storage_account_access_key=None): + + instance.storage_account_access_key = storage_account_access_key or instance.storage_account_access_key + + return instance + + ############################################### # sql dw # ############################################### diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index 370353a355c..810bcbb5a46 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -39,6 +39,14 @@ type: command short-summary: Updates a database. """ +helps['sql db audit-policy'] = """ + type: group + short-summary: Manage a database's auditing policy. + """ +helps['sql db audit-policy update'] = """ + type: command + short-summary: Updates a database's auditing policy. + """ helps['sql db replica'] = """ type: group short-summary: Manage replication between databases. @@ -63,6 +71,14 @@ type: command short-summary: Creates a new database by restoring from a database backup. """ +helps['sql db threat-detection-policy'] = """ + type: group + short-summary: Manage a database's threat detection policy. + """ +helps['sql db threat-detection-policy update'] = """ + type: command + short-summary: Updates a database's threat detection policy. + """ # helps['sql db restore-point'] = """ # type: group # short-summary: Manage database restore points. diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 7ae2e61af5b..bd45c2c2890 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -8,6 +8,7 @@ from ._util import ParametersContext, patch_arg_make_required from azure.cli.core.commands import CliArgumentType from azure.mgmt.sql.models.database import Database +from azure.mgmt.sql.models.database_blob_auditing_policy import DatabaseBlobAuditingPolicy from azure.mgmt.sql.models.elastic_pool import ElasticPool from azure.mgmt.sql.models.server import Server from azure.mgmt.sql.models.sql_management_client_enums import CreateMode @@ -317,17 +318,14 @@ def _configure_db_create_params( ##### -# sql db <> +# sql db audit-policy ##### -# Service tier advisor will not be included in the first batch of GA commands -# with ParametersContext(command='sql db service-tier-advisor') as c: -# c.register_alias('database_name', ('--database', '-d')) - -# TDE will not be included in the first batch of GA commands -# with ParametersContext(command='sql db transparent-data-encryption') as c: -# c.register_alias('database_name', ('--database', '-d')) +with ParametersContext(command='sql db audit-policy update') as c: + c.argument('storage_account_access_key', + options_list=('--storage-account-access-key',), + help='Access key for the storage account.') ############################################### diff --git a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml new file mode 100644 index 00000000000..2660201baf6 --- /dev/null +++ b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml @@ -0,0 +1,625 @@ +interactions: +- request: + body: '{"location": "westus", "tags": {"use": "az-test"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01 + response: + body: {string: '{"error":{"code":"MultipleErrorsOccurred","message":"Multiple + error occurred: . Please see details.","details":[{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013825Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', + request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013825Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', + request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013825Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', + request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013825Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', + request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."}]}}'} + headers: + cache-control: [no-cache] + connection: [close] + content-length: ['1326'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:38:25 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-failure-cause: [gateway] + status: {code: 500, message: Internal Server Error} +- request: + body: '{"location": "westus", "tags": {"use": "az-test"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['326'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:38:26 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: '{"location": "westus", "properties": {"administratorLogin": "admin123", + "administratorLoginPassword": "SecretPassword123"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql server create] + Connection: [keep-alive] + Content-Length: ['123'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002","name":"clitestserver000002","type":"Microsoft.Sql/servers","location":"West + US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000002.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":"SecretPassword123","externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['695'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:39:00 GMT'] + preference-applied: [return-content] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 201, message: Created} +- request: + body: '{"location": "westus", "kind": "Storage", "sku": {"name": "Standard_LRS"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Length: ['74'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 + response: + body: {string: '{"error":{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013915Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''7359e868-29e9-43aa-9e76-7b21cd7443f5'', + request correlation id ''7359e868-29e9-43aa-9e76-7b21cd7443f5''."}}'} + headers: + cache-control: [no-cache] + connection: [close] + content-length: ['312'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:39:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-failure-cause: [gateway] + status: {code: 500, message: Internal Server Error} +- request: + body: '{"location": "westus", "kind": "Storage", "sku": {"name": "Standard_LRS"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Length: ['74'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 16 Mar 2017 01:39:17 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/aa89f387-d22a-4bf2-9063-c7cd18364c47?monitor=true&api-version=2016-12-01'] + pragma: [no-cache] + retry-after: ['17'] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/aa89f387-d22a-4bf2-9063-c7cd18364c47?monitor=true&api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T01:39:16.8509870Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 01:39:33 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T01:39:16.8509870Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 01:39:36 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003/listKeys?api-version=2016-12-01 + response: + body: {string: '{"error":{"code":"InternalServerError","message":"Encountered + internal server error. Diagnostic information: timestamp ''20170316T013951Z'', + subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''89847ec1-fce9-47c3-a3ae-6fd60c617e77'', + request correlation id ''89847ec1-fce9-47c3-a3ae-6fd60c617e77''."}}'} + headers: + cache-control: [no-cache] + connection: [close] + content-length: ['312'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:39:51 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-failure-cause: [gateway] + status: {code: 500, message: Internal Server Error} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003/listKeys?api-version=2016-12-01 + response: + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw=="},{"keyName":"key2","permissions":"Full","value":"MewCrYzKSCnakh6icy4HW0QIyjKb5LDdZh7B2wSxQN9wrvB7s0tgT5a15UxqeEKxJmYQf9yGq8qM8CJ2bgRtNA=="}]} + + '} + headers: + cache-control: [no-cache] + content-length: ['289'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 01:39:53 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002","name":"clitestserver000002","type":"Microsoft.Sql/servers","location":"West + US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000002.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":null,"externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['680'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:39:55 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: '{"location": "West US"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db create] + Connection: [keep-alive] + Content-Length: ['23'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 + response: + body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489628395776+0000)\/"}'} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + cache-control: ['no-store, no-cache'] + content-length: ['80'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:39:56 GMT'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/operationResults/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + preference-applied: [return-content] + retry-after: ['30'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview + response: + body: {string: '{"operationId":"eb75ed0d-5533-4aac-ab85-de7985cf5a00","status":"InProgress","error":null}'} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + cache-control: ['no-store, no-cache'] + content-length: ['89'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:40:26 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview + response: + body: {string: '{"operationId":"eb75ed0d-5533-4aac-ab85-de7985cf5a00","status":"Succeeded","error":null}'} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + cache-control: ['no-store, no-cache'] + content-length: ['88'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:40:56 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West + US","kind":"v12.0,user","properties":{"databaseId":"72f8312e-42b5-4605-9429-1ee25a86ca50","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T01:39:55.963Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East + US","earliestRestoreDate":"2017-03-16T01:50:26.197Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['1000'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:40:57 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['618'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:40:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['618'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:41:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"retentionDays": 30, "isStorageSecondaryKeyInUse": false, + "storageAccountAccessKey": "RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP"], "storageAccountSubscriptionId": + "00000000-0000-0000-0000-000000000000", "state": "Enabled", "storageEndpoint": + "https://clitest000003.blob.core.windows.net/"}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Length: ['415'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['696'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 01:41:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West + US","kind":null,"properties":{"useServerDefault":"Enabled","state":"New","disabledAlerts":"Preview","emailAddresses":"","emailAccountAdmins":"Enabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['621'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:41:03 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West + US","kind":null,"properties":{"useServerDefault":"Enabled","state":"New","disabledAlerts":"Preview","emailAddresses":"","emailAccountAdmins":"Enabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['621'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:41:05 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"retentionDays": 30, "storageAccountAccessKey": "RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==", + "disabledAlerts": "Sql_Injection_Vulnerability; Access_Anomaly", "useServerDefault": + "Enabled", "emailAddresses": "test1@example.com; test2@example.com", "state": + "Enabled", "storageEndpoint": "https://clitest000003.blob.core.windows.net/", + "emailAccountAdmins": "Enabled"}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Length: ['441'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability; + Access_Anomaly","emailAddresses":"test1@example.com; test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==","retentionDays":30}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['836'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 01:41:08 GMT'] + preference-applied: [return-content] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 16 Mar 2017 01:41:10 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdFN0JENDIxRUQ0QUMwNDIyQ0FBRDczNkRFMkIwRDhBMzE4Qnw0QzM4QzNEQjk1QzUzODg3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + pragma: [no-cache] + retry-after: ['15'] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index 9878fec6aae..ca45b0441ba 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -9,7 +9,8 @@ JMESPathCheck, NoneCheck, ResourceGroupPreparer, - ScenarioTest) + ScenarioTest, + StorageAccountPreparer) from azure.cli.testsdk.preparers import ( AbstractPreparer, SingleValueReplacer) @@ -395,6 +396,83 @@ def test_sql_db_restore(self, resource_group, resource_group_location, server): JMESPathCheck('status', 'Online')]) +class SqlServerDbSecurityScenarioTest(ScenarioTest): + @ResourceGroupPreparer() + @SqlServerPreparer() + @StorageAccountPreparer() + def test_sql_db_security_mgmt(self, resource_group, resource_group_location, server, + storage_account): + database_name = "cliautomationdb01" + + # get storage account endpoint + storage_endpoint = self.cmd('storage account show -g {} -n {}' + ' --query primaryEndpoints.blob' + .format(resource_group, storage_account)).get_output_in_json() + + print(storage_endpoint) + + # get storage account key + key = self.cmd('storage account keys list -g {} -n {} --query [0].value' + .format(resource_group, storage_account)).get_output_in_json() + + print(key) + + # create db + self.cmd('sql db create -g {} -s {} -n {}' + .format(resource_group, server, database_name), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('name', database_name), + JMESPathCheck('status', 'Online')]) + + # get audit policy + self.cmd('sql db audit-policy show -g {} -s {} -n {}' + .format(resource_group, server, database_name), + checks=[JMESPathCheck('resourceGroup', resource_group)]) + + # update audit policy + state = 'Enabled' + access_key = key + retention_days = 30 + audit_group = 'DATABASE_LOGOUT_GROUP' + + self.cmd('sql db audit-policy update -g {} -s {} -n {}' + ' --set state={} --storage-account-access-key {} --set storageEndpoint={}' + ' --set retentionDays={} --add auditActionsAndGroups {}' + .format(resource_group, server, database_name, state, access_key, + storage_endpoint, retention_days, audit_group), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state), + JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it + JMESPathCheck('storageEndpoint', storage_endpoint), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('auditActionsAndGroups[0]', audit_group)]) + + # get threat detection policy + self.cmd('sql db threat-detection-policy show -g {} -s {} -n {}' + .format(resource_group, server, database_name), + checks=[JMESPathCheck('resourceGroup', resource_group)]) + + # update threat detection policy + disabled_alerts = 'Sql_Injection_Vulnerability; Access_Anomaly' + email_addresses = 'test1@example.com; test2@example.com' + + self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' + ' --set state={} --storage-account-access-key {} --set storageEndpoint={}' + ' --set retentionDays={} --set emailAddresses=\'{}\' --set disabledAlerts=\'{}\'' + .format(resource_group, server, database_name, state, access_key, + storage_endpoint, retention_days, email_addresses, disabled_alerts), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state), + JMESPathCheck('storageAccountAccessKey', access_key), + JMESPathCheck('storageEndpoint', storage_endpoint), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('emailAddresses', email_addresses), + JMESPathCheck('disabledAlerts', disabled_alerts)]) + + class SqlServerDwMgmtScenarioTest(ScenarioTest): # pylint: disable=too-many-instance-attributes @ResourceGroupPreparer() From 4fccee1438176b9efc4de5a3f4e111157e9ee710 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 18:42:42 -0700 Subject: [PATCH 05/19] Removed debug print statements --- src/command_modules/azure-cli-sql/tests/test_sql_commands.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index ca45b0441ba..3716e496459 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -409,14 +409,10 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser ' --query primaryEndpoints.blob' .format(resource_group, storage_account)).get_output_in_json() - print(storage_endpoint) - # get storage account key key = self.cmd('storage account keys list -g {} -n {} --query [0].value' .format(resource_group, storage_account)).get_output_in_json() - print(key) - # create db self.cmd('sql db create -g {} -s {} -n {}' .format(resource_group, server, database_name), From 8e48a89a8b8d3875c9d0d3e5430de6d5fd1d0a0c Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 18:46:33 -0700 Subject: [PATCH 06/19] storage-account-access-key -> storage-key --- .../azure/cli/command_modules/sql/params.py | 12 +++++++++++- .../azure-cli-sql/tests/test_sql_commands.py | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index bd45c2c2890..3ea8a20dca7 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -324,10 +324,20 @@ def _configure_db_create_params( with ParametersContext(command='sql db audit-policy update') as c: c.argument('storage_account_access_key', - options_list=('--storage-account-access-key',), + options_list=('--storage-key',), help='Access key for the storage account.') +##### +# sql db threat-detection-policy +##### + + +with ParametersContext(command='sql db threat-detection-policy update') as c: + c.argument('storage_account_access_key', + options_list=('--storage-key',), + help='Access key for the storage account.') + ############################################### # sql dw # ############################################### diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index 3716e496459..b0db111b545 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -433,7 +433,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser audit_group = 'DATABASE_LOGOUT_GROUP' self.cmd('sql db audit-policy update -g {} -s {} -n {}' - ' --set state={} --storage-account-access-key {} --set storageEndpoint={}' + ' --set state={} --storage-key {} --set storageEndpoint={}' ' --set retentionDays={} --add auditActionsAndGroups {}' .format(resource_group, server, database_name, state, access_key, storage_endpoint, retention_days, audit_group), @@ -455,7 +455,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser email_addresses = 'test1@example.com; test2@example.com' self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' - ' --set state={} --storage-account-access-key {} --set storageEndpoint={}' + ' --set state={} --storage-key {} --set storageEndpoint={}' ' --set retentionDays={} --set emailAddresses=\'{}\' --set disabledAlerts=\'{}\'' .format(resource_group, server, database_name, state, access_key, storage_endpoint, retention_days, email_addresses, disabled_alerts), From 2078105895349e4f20b9adbab8aec7650ceaa78b Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 20:45:09 -0700 Subject: [PATCH 07/19] Added custom funcs and params --- .../azure/cli/command_modules/sql/custom.py | 50 +++- .../azure/cli/command_modules/sql/params.py | 44 +++- .../recordings/test_sql_db_security_mgmt.yaml | 228 +++++------------- .../azure-cli-sql/tests/test_sql_commands.py | 32 ++- 4 files changed, 172 insertions(+), 182 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index bcbc93ff38e..b76823f1124 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -333,18 +333,60 @@ def db_update( def db_audit_policy_update( instance, - storage_account_access_key=None): + storage_account_access_key=None, + audit_actions_and_groups=None, + state=None, + retention_days=None, + storage_endpoint=None): - instance.storage_account_access_key = storage_account_access_key or instance.storage_account_access_key + if storage_account_access_key != None: + instance.storage_account_access_key = storage_account_access_key + + if audit_actions_and_groups != None: + instance.audit_actions_and_groups = audit_actions_and_groups + + if state != None: + instance.state = state + + if retention_days != None: + instance.retention_days = retention_days + + if storage_endpoint != None: + instance.storage_endpoint = storage_endpoint return instance def db_threat_detection_policy_update( instance, - storage_account_access_key=None): + storage_account_access_key=None, + state=None, + retention_days=None, + storage_endpoint=None, + email_addresses=None, + disabled_alerts=None, + email_account_admins=None): + + if storage_account_access_key != None: + instance.storage_account_access_key = storage_account_access_key + + if state != None: + instance.state = state + + if retention_days != None: + instance.retention_days = retention_days + + if storage_endpoint != None: + instance.storage_endpoint = storage_endpoint + + if email_addresses != None: + instance.email_addresses = ";".join(email_addresses) + + if disabled_alerts != None: + instance.disabled_alerts = ";".join(disabled_alerts) - instance.storage_account_access_key = storage_account_access_key or instance.storage_account_access_key + if email_account_admins != None: + instance.email_account_admins = email_account_admins return instance diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 3ea8a20dca7..06681beaebf 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -7,11 +7,15 @@ from enum import Enum from ._util import ParametersContext, patch_arg_make_required from azure.cli.core.commands import CliArgumentType +from azure.cli.core.commands.parameters import enum_choice_list from azure.mgmt.sql.models.database import Database from azure.mgmt.sql.models.database_blob_auditing_policy import DatabaseBlobAuditingPolicy from azure.mgmt.sql.models.elastic_pool import ElasticPool from azure.mgmt.sql.models.server import Server -from azure.mgmt.sql.models.sql_management_client_enums import CreateMode +from azure.mgmt.sql.models.sql_management_client_enums import ( + BlobAuditingPolicyState, + CreateMode, + SecurityAlertPolicyState) ##### # Reusable param type definitions @@ -327,6 +331,20 @@ def _configure_db_create_params( options_list=('--storage-key',), help='Access key for the storage account.') + c.argument('storage_endpoint', + help='The storage account endpoint.') + + c.argument('audit_actions_and_groups', + options_list=('--actions',), + help='List of actions and action groups to audit.', + nargs='+') + + c.argument('state', + help='Auditing policy state') + + c.argument('retention_days', + help='The number of days to retain audit logs.') + ##### # sql db threat-detection-policy @@ -338,6 +356,30 @@ def _configure_db_create_params( options_list=('--storage-key',), help='Access key for the storage account.') + c.argument('storage_endpoint', + help='The storage account endpoint.') + + c.argument('state', + help='Auditing policy state', + **enum_choice_list(BlobAuditingPolicyState)) + + c.argument('retention_days', + help='The number of days to retain threat detection logs.') + + c.argument('email_addresses', + options_list=('--email-addresses',), + help='List of email addresses that alerts are sent to.', + nargs='+') + + c.argument('disabled_alerts', + options_list=('--disabled-alerts',), + help='List of disabled alerts.', + nargs='+') + + c.argument('email_account_admins', + options_list=('--email-account-admins',), + help='Whether the alert is sent to the account administrators.') + ############################################### # sql dw # ############################################### diff --git a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml index 2660201baf6..dd54642fe80 100644 --- a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml +++ b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml @@ -1,47 +1,6 @@ interactions: - request: - body: '{"location": "westus", "tags": {"use": "az-test"}}' - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [group create] - Connection: [keep-alive] - Content-Length: ['50'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 - msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python - AZURECLI/2.0.1+dev] - accept-language: [en-US] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2016-09-01 - response: - body: {string: '{"error":{"code":"MultipleErrorsOccurred","message":"Multiple - error occurred: . Please see details.","details":[{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013825Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', - request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013825Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', - request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013825Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', - request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."},{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013825Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d'', - request correlation id ''75b4a47c-a5f7-4842-97f6-3cd5b28ad04d''."}]}}'} - headers: - cache-control: [no-cache] - connection: [close] - content-length: ['1326'] - content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:38:25 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-failure-cause: [gateway] - status: {code: 500, message: Internal Server Error} -- request: - body: '{"location": "westus", "tags": {"use": "az-test"}}' + body: '{"tags": {"use": "az-test"}, "location": "westus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -61,15 +20,15 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:38:26 GMT'] + date: ['Thu, 16 Mar 2017 03:12:50 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: - body: '{"location": "westus", "properties": {"administratorLogin": "admin123", - "administratorLoginPassword": "SecretPassword123"}}' + body: '{"properties": {"administratorLoginPassword": "SecretPassword123", "administratorLogin": + "admin123"}, "location": "westus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -90,45 +49,15 @@ interactions: content-length: ['695'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:39:00 GMT'] + date: ['Thu, 16 Mar 2017 03:13:40 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: - body: '{"location": "westus", "kind": "Storage", "sku": {"name": "Standard_LRS"}}' - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [storage account create] - Connection: [keep-alive] - Content-Length: ['74'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] - accept-language: [en-US] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 - response: - body: {string: '{"error":{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013915Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''7359e868-29e9-43aa-9e76-7b21cd7443f5'', - request correlation id ''7359e868-29e9-43aa-9e76-7b21cd7443f5''."}}'} - headers: - cache-control: [no-cache] - connection: [close] - content-length: ['312'] - content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:39:14 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-failure-cause: [gateway] - status: {code: 500, message: Internal Server Error} -- request: - body: '{"location": "westus", "kind": "Storage", "sku": {"name": "Standard_LRS"}}' + body: '{"kind": "Storage", "location": "westus", "sku": {"name": "Standard_LRS"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -146,14 +75,14 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 01:39:17 GMT'] + date: ['Thu, 16 Mar 2017 03:13:42 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/aa89f387-d22a-4bf2-9063-c7cd18364c47?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/767e787a-4283-47b1-ac84-079ffbedad8d?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} - request: body: null @@ -167,16 +96,16 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/aa89f387-d22a-4bf2-9063-c7cd18364c47?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/767e787a-4283-47b1-ac84-079ffbedad8d?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T01:39:16.8509870Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T03:13:42.9268635Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 01:39:33 GMT'] + date: ['Thu, 16 Mar 2017 03:14:00 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -198,14 +127,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T01:39:16.8509870Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T03:13:42.9268635Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 01:39:36 GMT'] + date: ['Thu, 16 Mar 2017 03:14:03 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -228,44 +157,14 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003/listKeys?api-version=2016-12-01 response: - body: {string: '{"error":{"code":"InternalServerError","message":"Encountered - internal server error. Diagnostic information: timestamp ''20170316T013951Z'', - subscription id ''2e7fe4bd-90c7-454e-8bb6-dc44649f27b2'', tracking id ''89847ec1-fce9-47c3-a3ae-6fd60c617e77'', - request correlation id ''89847ec1-fce9-47c3-a3ae-6fd60c617e77''."}}'} - headers: - cache-control: [no-cache] - connection: [close] - content-length: ['312'] - content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:39:51 GMT'] - expires: ['-1'] - pragma: [no-cache] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-failure-cause: [gateway] - status: {code: 500, message: Internal Server Error} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [storage account keys list] - Connection: [keep-alive] - Content-Length: ['0'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 - msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] - accept-language: [en-US] - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003/listKeys?api-version=2016-12-01 - response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw=="},{"keyName":"key2","permissions":"Full","value":"MewCrYzKSCnakh6icy4HW0QIyjKb5LDdZh7B2wSxQN9wrvB7s0tgT5a15UxqeEKxJmYQf9yGq8qM8CJ2bgRtNA=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg=="},{"keyName":"key2","permissions":"Full","value":"ykjln4WQcc+CUfH9zdEiCuLsk9StFwzoEwjWzA3oF8LOUFfBJWa4lpK80auj1DNB8vs64/3quSX55nADaciQJA=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 01:39:53 GMT'] + date: ['Thu, 16 Mar 2017 03:14:05 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -295,7 +194,7 @@ interactions: content-length: ['680'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:39:55 GMT'] + date: ['Thu, 16 Mar 2017 03:14:07 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -317,21 +216,21 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 response: - body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489628395776+0000)\/"}'} + body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489634047590+0000)\/"}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['80'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:39:56 GMT'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/operationResults/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + date: ['Thu, 16 Mar 2017 03:14:08 GMT'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/operationResults/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] preference-applied: [return-content] retry-after: ['30'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} - request: body: null @@ -345,16 +244,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview response: - body: {string: '{"operationId":"eb75ed0d-5533-4aac-ab85-de7985cf5a00","status":"InProgress","error":null}'} + body: {string: '{"operationId":"64984912-f2cd-418d-ab31-bc69a933f1e6","status":"InProgress","error":null}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['89'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:40:26 GMT'] + date: ['Thu, 16 Mar 2017 03:14:40 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -373,16 +272,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview response: - body: {string: '{"operationId":"eb75ed0d-5533-4aac-ab85-de7985cf5a00","status":"Succeeded","error":null}'} + body: {string: '{"operationId":"64984912-f2cd-418d-ab31-bc69a933f1e6","status":"Succeeded","error":null}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/eb75ed0d-5533-4aac-ab85-de7985cf5a00?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['88'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:40:56 GMT'] + date: ['Thu, 16 Mar 2017 03:15:12 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -404,14 +303,14 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 response: body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West - US","kind":"v12.0,user","properties":{"databaseId":"72f8312e-42b5-4605-9429-1ee25a86ca50","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T01:39:55.963Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East - US","earliestRestoreDate":"2017-03-16T01:50:26.197Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} + US","kind":"v12.0,user","properties":{"databaseId":"2bfa7a38-5cd0-45d1-938f-617978e4ce4b","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T03:14:07.81Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East + US","earliestRestoreDate":"2017-03-16T03:24:46.817Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} headers: cache-control: ['no-store, no-cache'] - content-length: ['1000'] + content-length: ['999'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:40:57 GMT'] + date: ['Thu, 16 Mar 2017 03:15:12 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -437,7 +336,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:40:59 GMT'] + date: ['Thu, 16 Mar 2017 03:15:16 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -464,7 +363,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:41:00 GMT'] + date: ['Thu, 16 Mar 2017 03:15:19 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -473,17 +372,17 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"retentionDays": 30, "isStorageSecondaryKeyInUse": false, - "storageAccountAccessKey": "RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP"], "storageAccountSubscriptionId": - "00000000-0000-0000-0000-000000000000", "state": "Enabled", "storageEndpoint": - "https://clitest000003.blob.core.windows.net/"}}''' + body: 'b''{"properties": {"auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + "state": "Enabled", "isStorageSecondaryKeyInUse": false, "storageAccountAccessKey": + "NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==", + "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", "storageEndpoint": + "https://clitest000003.blob.core.windows.net/", "retentionDays": 30}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [sql db audit-policy update] Connection: [keep-alive] - Content-Length: ['415'] + Content-Length: ['452'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] @@ -491,17 +390,17 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} headers: cache-control: [no-cache] - content-length: ['696'] + content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 01:41:01 GMT'] + date: ['Thu, 16 Mar 2017 03:15:25 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: body: null @@ -524,7 +423,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:41:03 GMT'] + date: ['Thu, 16 Mar 2017 03:15:26 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -552,7 +451,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:41:05 GMT'] + date: ['Thu, 16 Mar 2017 03:15:28 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -560,17 +459,17 @@ interactions: x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"retentionDays": 30, "storageAccountAccessKey": "RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==", - "disabledAlerts": "Sql_Injection_Vulnerability; Access_Anomaly", "useServerDefault": - "Enabled", "emailAddresses": "test1@example.com; test2@example.com", "state": - "Enabled", "storageEndpoint": "https://clitest000003.blob.core.windows.net/", - "emailAccountAdmins": "Enabled"}}''' + body: 'b''{"properties": {"disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", + "emailAddresses": "test1@example.com;test2@example.com", "useServerDefault": + "Enabled", "emailAccountAdmins": "Enabled", "storageAccountAccessKey": "NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==", + "retentionDays": 30, "storageEndpoint": "https://clitest000003.blob.core.windows.net/", + "state": "Enabled"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [sql db threat-detection-policy update] Connection: [keep-alive] - Content-Length: ['441'] + Content-Length: ['439'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] @@ -578,21 +477,20 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability; - Access_Anomaly","emailAddresses":"test1@example.com; test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"RTPGcw+X0EYZWQOEeWj2q+Bab77/XrLeOE1etpyt79WESOWsvcgMp+eqJEM/PIU0SdsEo5uGOJSZ5hTl8CMulw==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] - content-length: ['836'] + content-length: ['834'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 01:41:08 GMT'] + date: ['Thu, 16 Mar 2017 03:15:34 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -614,12 +512,12 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 01:41:10 GMT'] + date: ['Thu, 16 Mar 2017 03:15:35 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdFN0JENDIxRUQ0QUMwNDIyQ0FBRDczNkRFMkIwRDhBMzE4Qnw0QzM4QzNEQjk1QzUzODg3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkc0N0ZEQzU5RDZDQjJGMTE2NDUxREFBMDhGM0U5NEFDNjVCMXw5NzlEQzFCNEM5ODgxNjU3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 202, message: Accepted} version: 1 diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index b0db111b545..6f8e5a0a7fa 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -430,20 +430,22 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser state = 'Enabled' access_key = key retention_days = 30 - audit_group = 'DATABASE_LOGOUT_GROUP' + audit_actions_input = 'DATABASE_LOGOUT_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP' + audit_actions_expected = ['DATABASE_LOGOUT_GROUP', + 'DATABASE_ROLE_MEMBER_CHANGE_GROUP'] self.cmd('sql db audit-policy update -g {} -s {} -n {}' - ' --set state={} --storage-key {} --set storageEndpoint={}' - ' --set retentionDays={} --add auditActionsAndGroups {}' + ' --state {} --storage-key {} --storage-endpoint={}' + ' --retention-days={} --actions {}' .format(resource_group, server, database_name, state, access_key, - storage_endpoint, retention_days, audit_group), + storage_endpoint, retention_days, audit_actions_input), checks=[ JMESPathCheck('resourceGroup', resource_group), JMESPathCheck('state', state), JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it JMESPathCheck('storageEndpoint', storage_endpoint), JMESPathCheck('retentionDays', retention_days), - JMESPathCheck('auditActionsAndGroups[0]', audit_group)]) + JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) # get threat detection policy self.cmd('sql db threat-detection-policy show -g {} -s {} -n {}' @@ -451,22 +453,28 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser checks=[JMESPathCheck('resourceGroup', resource_group)]) # update threat detection policy - disabled_alerts = 'Sql_Injection_Vulnerability; Access_Anomaly' - email_addresses = 'test1@example.com; test2@example.com' + disabled_alerts_input = 'Sql_Injection_Vulnerability Access_Anomaly' + disabled_alerts_expected = 'Sql_Injection_Vulnerability;Access_Anomaly' + email_addresses_input = 'test1@example.com test2@example.com' + email_addresses_expected = 'test1@example.com;test2@example.com' + email_account_admins = 'Enabled' self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' - ' --set state={} --storage-key {} --set storageEndpoint={}' - ' --set retentionDays={} --set emailAddresses=\'{}\' --set disabledAlerts=\'{}\'' + ' --state {} --storage-key {} --storage-endpoint {}' + ' --retention-days {} --email-addresses {} --disabled-alerts {}' + ' --email-account-admins {}' .format(resource_group, server, database_name, state, access_key, - storage_endpoint, retention_days, email_addresses, disabled_alerts), + storage_endpoint, retention_days, email_addresses_input, + disabled_alerts_input, email_account_admins), checks=[ JMESPathCheck('resourceGroup', resource_group), JMESPathCheck('state', state), JMESPathCheck('storageAccountAccessKey', access_key), JMESPathCheck('storageEndpoint', storage_endpoint), JMESPathCheck('retentionDays', retention_days), - JMESPathCheck('emailAddresses', email_addresses), - JMESPathCheck('disabledAlerts', disabled_alerts)]) + JMESPathCheck('emailAddresses', email_addresses_expected), + JMESPathCheck('disabledAlerts', disabled_alerts_expected), + JMESPathCheck('emailAccountAdmins', email_account_admins)]) class SqlServerDwMgmtScenarioTest(ScenarioTest): From a8518a74616255b6b8c8d6c5e45920af326a8641 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Wed, 15 Mar 2017 20:51:48 -0700 Subject: [PATCH 08/19] FIxed style errors --- .../azure/cli/command_modules/sql/custom.py | 70 +++++++++++-------- .../azure/cli/command_modules/sql/params.py | 8 +-- .../azure-cli-sql/tests/test_sql_commands.py | 2 +- 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index b76823f1124..2477abae2e8 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -331,61 +331,73 @@ def db_update( return instance -def db_audit_policy_update( - instance, - storage_account_access_key=None, - audit_actions_and_groups=None, - state=None, - retention_days=None, - storage_endpoint=None): - - if storage_account_access_key != None: +##### +# sql server audit-policy +##### + + +# Update audit policy. Custom update function to apply parameters to instance. +def db_audit_policy_update( # pylint: disable=too-many-arguments + instance, + storage_account_access_key=None, + audit_actions_and_groups=None, + state=None, + retention_days=None, + storage_endpoint=None): + + if storage_account_access_key is not None: instance.storage_account_access_key = storage_account_access_key - if audit_actions_and_groups != None: + if audit_actions_and_groups is not None: instance.audit_actions_and_groups = audit_actions_and_groups - if state != None: + if state is not None: instance.state = state - if retention_days != None: + if retention_days is not None: instance.retention_days = retention_days - if storage_endpoint != None: + if storage_endpoint is not None: instance.storage_endpoint = storage_endpoint return instance -def db_threat_detection_policy_update( - instance, - storage_account_access_key=None, - state=None, - retention_days=None, - storage_endpoint=None, - email_addresses=None, - disabled_alerts=None, - email_account_admins=None): +##### +# sql server threat-detection-policy +##### - if storage_account_access_key != None: + +# Update threat detection policy. Custom update function to apply parameters to instance. +def db_threat_detection_policy_update( # pylint: disable=too-many-arguments + instance, + storage_account_access_key=None, + state=None, + retention_days=None, + storage_endpoint=None, + email_addresses=None, + disabled_alerts=None, + email_account_admins=None): + + if storage_account_access_key is not None: instance.storage_account_access_key = storage_account_access_key - if state != None: + if state is not None: instance.state = state - if retention_days != None: + if retention_days is not None: instance.retention_days = retention_days - if storage_endpoint != None: + if storage_endpoint is not None: instance.storage_endpoint = storage_endpoint - if email_addresses != None: + if email_addresses is not None: instance.email_addresses = ";".join(email_addresses) - if disabled_alerts != None: + if disabled_alerts is not None: instance.disabled_alerts = ";".join(disabled_alerts) - if email_account_admins != None: + if email_account_admins is not None: instance.email_account_admins = email_account_admins return instance diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 06681beaebf..00222c54e76 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -9,7 +9,6 @@ from azure.cli.core.commands import CliArgumentType from azure.cli.core.commands.parameters import enum_choice_list from azure.mgmt.sql.models.database import Database -from azure.mgmt.sql.models.database_blob_auditing_policy import DatabaseBlobAuditingPolicy from azure.mgmt.sql.models.elastic_pool import ElasticPool from azure.mgmt.sql.models.server import Server from azure.mgmt.sql.models.sql_management_client_enums import ( @@ -340,7 +339,8 @@ def _configure_db_create_params( nargs='+') c.argument('state', - help='Auditing policy state') + help='Auditing policy state', + **enum_choice_list(BlobAuditingPolicyState)) c.argument('retention_days', help='The number of days to retain audit logs.') @@ -360,8 +360,8 @@ def _configure_db_create_params( help='The storage account endpoint.') c.argument('state', - help='Auditing policy state', - **enum_choice_list(BlobAuditingPolicyState)) + help='Threat detection policy state', + **enum_choice_list(SecurityAlertPolicyState)) c.argument('retention_days', help='The number of days to retain threat detection logs.') diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index 6f8e5a0a7fa..70cf96b3af9 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -411,7 +411,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser # get storage account key key = self.cmd('storage account keys list -g {} -n {} --query [0].value' - .format(resource_group, storage_account)).get_output_in_json() + .format(resource_group, storage_account)).get_output_in_json() # create db self.cmd('sql db create -g {} -s {} -n {}' From 04748e2f4985da9610b0cc0b5a5bccb8b77b4e0c Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 16 Mar 2017 03:23:50 -0700 Subject: [PATCH 09/19] Trying to use enum_choice_list --- .../azure/cli/command_modules/sql/params.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 00222c54e76..202dc38065f 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -14,7 +14,9 @@ from azure.mgmt.sql.models.sql_management_client_enums import ( BlobAuditingPolicyState, CreateMode, - SecurityAlertPolicyState) + SecurityAlertPolicyState, + SecurityAlertPolicyEmailAccountAdmins, + SecurityAlertPolicyUseServerDefault) ##### # Reusable param type definitions @@ -378,7 +380,10 @@ def _configure_db_create_params( c.argument('email_account_admins', options_list=('--email-account-admins',), - help='Whether the alert is sent to the account administrators.') + help='Whether the alert is sent to the account administrators.', + **enum_choice_list(SecurityAlertPolicyEmailAccountAdmins)) + + # TODO: use server default ############################################### # sql dw # From 369b5c2be0f7b67451a6378751f857a63146f5c1 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 16 Mar 2017 16:06:22 -0700 Subject: [PATCH 10/19] Added storage helper parameters --- .../azure/cli/command_modules/sql/custom.py | 169 ++++- .../azure/cli/command_modules/sql/help.py | 266 ++++--- .../azure/cli/command_modules/sql/params.py | 74 +- src/command_modules/azure-cli-sql/setup.py | 1 + .../recordings/test_sql_db_security_mgmt.yaml | 706 +++++++++++++++--- .../azure-cli-sql/tests/test_sql_commands.py | 99 ++- 6 files changed, 1042 insertions(+), 273 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index 2477abae2e8..dfede353a44 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -8,14 +8,22 @@ get_sql_elasticpools_operations ) -from azure.cli.core.commands.client_factory import get_subscription_id +from azure.cli.core.commands.client_factory import ( + get_mgmt_service_client, + get_subscription_id) from azure.cli.core._util import CLIError from azure.mgmt.sql.models.sql_management_client_enums import ( + BlobAuditingPolicyState, CreateMode, DatabaseEditions, ReplicationRole, - ServiceObjectiveName, + SecurityAlertPolicyState, + ServiceObjectiveName ) +from azure.mgmt.storage import StorageManagementClient + +# url parse package has different names in Python 2 and 3. 'six' package works cross-version. +from six.moves.urllib.parse import (quote, urlparse) # pylint: disable=import-error ############################################### # Common funcs # @@ -98,8 +106,6 @@ def _db_create_special( resource_group_name=dest_db.resource_group_name) # Set create mode properties - # url parse package has different names in Python 2 and 3. 'six' package works cross-version. - from six.moves.urllib.parse import quote # pylint: disable=import-error subscription_id = get_subscription_id() kwargs['source_database_id'] = ( '/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}' @@ -332,65 +338,168 @@ def db_update( ##### -# sql server audit-policy +# sql server audit-policy & threat-detection-policy ##### +# Determines storage account name from endpoint url string. +# e.g. 'https://mystorage.blob.core.windows.net' -> 'mystorage' +def _get_storage_account_name(storage_endpoint): + return urlparse(storage_endpoint).netloc.split('.')[0] + + +# Gets storage account key by querying storage ARM API. +def _get_storage_endpoint( + storage_account, + resource_group_name): + + # Get storage account + client = get_mgmt_service_client(StorageManagementClient) + account = client.storage_accounts.get_properties( + resource_group_name=resource_group_name, + account_name=storage_account) + + # Get endpoint + return account.primary_endpoints.blob # pylint: disable=no-member + + +# Gets storage account key by querying storage ARM API. +def _get_storage_key( + storage_account, + resource_group_name, + use_secondary_key): + + # Get storage keys + client = get_mgmt_service_client(StorageManagementClient) + keys = client.storage_accounts.list_keys( + resource_group_name=resource_group_name, + account_name=storage_account) + + # Choose storage key + index = 1 if use_secondary_key else 0 + return keys.keys[index].value # pylint: disable=no-member + +# Common code for updating audit and threat detection policy +def _db_security_policy_update( # pylint: disable=too-many-arguments + instance, + resource_group_name, + enabled, + storage_account, + storage_resource_group, + storage_endpoint, + storage_account_access_key, + use_secondary_key): + + # Validate storage endpoint arguments + if storage_endpoint is not None and storage_account is not None: + raise CLIError('--storage-endpoint and --storage-account cannot both be specified.') + if storage_resource_group is not None and storage_account is None: + raise CLIError('If --storage-resource-group is specified, --storage-account must be' + ' specified.') + + # Set storage endpoint + storage_resource_group = storage_resource_group or resource_group_name + if storage_endpoint is not None: + instance.storage_endpoint = storage_endpoint + if storage_account is not None: + instance.storage_endpoint = _get_storage_endpoint(storage_account, storage_resource_group) + + # Set storage access key + if storage_account_access_key is not None: + # Access key is specified + instance.storage_account_access_key = storage_account_access_key + elif enabled: + # Access key is not specified, but state is Enabled. + # If state is Enabled, then access key property is required in PUT. However access key is + # readonly (GET returns empty string for access key), so we need to determine the value + # and then PUT it back. (We don't want the user to be force to specify this, because that + # would be very annoying when updating non-storage-related properties). + # This doesn't work if the user used generic update args, i.e. `--set state=Enabled` + # instead of `--state Enabled`, since the generic update args are applied after this custom + # function, but at least we tried. + if storage_account is None: + storage_account = _get_storage_account_name(instance.storage_endpoint) + + instance.storage_account_access_key = _get_storage_key( + storage_account, + storage_resource_group, + use_secondary_key) + + # Update audit policy. Custom update function to apply parameters to instance. def db_audit_policy_update( # pylint: disable=too-many-arguments instance, + resource_group_name, + state=None, + storage_account=None, + storage_resource_group=None, + storage_endpoint=None, storage_account_access_key=None, audit_actions_and_groups=None, - state=None, - retention_days=None, - storage_endpoint=None): + retention_days=None): - if storage_account_access_key is not None: - instance.storage_account_access_key = storage_account_access_key + # Apply state + if state is not None: + # pylint: disable=unsubscriptable-object + instance.state = BlobAuditingPolicyState[state.lower()] + enabled = instance.state.value.lower() == BlobAuditingPolicyState.enabled.value.lower() + + # Set storage-related properties + _db_security_policy_update( + instance, + resource_group_name, + enabled, + storage_account, + storage_resource_group, + storage_endpoint, + storage_account_access_key, + instance.is_storage_secondary_key_in_use) + # Set other properties if audit_actions_and_groups is not None: instance.audit_actions_and_groups = audit_actions_and_groups - if state is not None: - instance.state = state - if retention_days is not None: instance.retention_days = retention_days - if storage_endpoint is not None: - instance.storage_endpoint = storage_endpoint - return instance -##### -# sql server threat-detection-policy -##### - - # Update threat detection policy. Custom update function to apply parameters to instance. def db_threat_detection_policy_update( # pylint: disable=too-many-arguments instance, - storage_account_access_key=None, + resource_group_name, state=None, - retention_days=None, + storage_account=None, + storage_resource_group=None, storage_endpoint=None, + storage_account_access_key=None, + retention_days=None, email_addresses=None, disabled_alerts=None, email_account_admins=None): - if storage_account_access_key is not None: - instance.storage_account_access_key = storage_account_access_key - + # Apply state if state is not None: - instance.state = state + # pylint: disable=unsubscriptable-object + instance.state = SecurityAlertPolicyState[state.lower()] + enabled = instance.state.value.lower() == SecurityAlertPolicyState.enabled.value.lower() + # Set storage-related properties + _db_security_policy_update( + instance, + resource_group_name, + enabled, + storage_account, + storage_resource_group, + storage_endpoint, + storage_account_access_key, + False) + + # Set other properties if retention_days is not None: instance.retention_days = retention_days - if storage_endpoint is not None: - instance.storage_endpoint = storage_endpoint - if email_addresses is not None: instance.email_addresses = ";".join(email_addresses) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index 810bcbb5a46..ba96dad183a 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -8,77 +8,127 @@ # pylint: disable=line-too-long helps['sql'] = """ - type: group - short-summary: Manage Azure SQL Databases and Data Warehouses. - """ + type: group + short-summary: Manage Azure SQL Databases and Data Warehouses. + """ helps['sql db'] = """ - type: group - short-summary: Manage databases. - """ + type: group + short-summary: Manage databases. + """ helps['sql db copy'] = """ - type: command - short-summary: Creates a copy of an existing database. - """ + type: command + short-summary: Creates a copy of an existing database. + """ helps['sql db create'] = """ - type: command - short-summary: Creates a database. - """ + type: command + short-summary: Creates a database. + """ helps['sql db delete'] = """ - type: command - short-summary: Deletes a database or data warehouse. - """ + type: command + short-summary: Deletes a database or data warehouse. + """ helps['sql db list'] = """ - type: command - short-summary: Lists all databases and data warehouses in a server, or all databases in an elastic pool. - """ + type: command + short-summary: Lists all databases and data warehouses in a server, or all databases in an elastic pool. + """ helps['sql db show'] = """ - type: command - short-summary: Gets a database or data warehouse. - """ + type: command + short-summary: Gets a database or data warehouse. + """ helps['sql db update'] = """ - type: command - short-summary: Updates a database. - """ + type: command + short-summary: Updates a database. + """ helps['sql db audit-policy'] = """ - type: group - short-summary: Manage a database's auditing policy. - """ + type: group + short-summary: Manage a database's auditing policy. + """ helps['sql db audit-policy update'] = """ - type: command - short-summary: Updates a database's auditing policy. - """ + type: command + short-summary: Updates a database's auditing policy. + long-summary: If the policy is being enabled, storage_account or both storage_endpoint and + storage_account_access_key must be specified. + examples: + - name: Enable an auditing policy by specifying storage account name + text: az db audit-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-account mystorage + - name: Enable an auditing policy by specifying storage account name and resource + group + text: az db audit-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-account mystorage --storage-resource-group mygroup2 + - name: Enable an auditing policy by specifying storage endpoint and key + text: az db audit-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net + --storage-key MYKEY== + - name: Set the list of audit actions + text: az db audit-policy update -g mygroup -s myserver -n mydb + --actions FAILED_DATABASE_AUTHENTICATION_GROUP 'UPDATE on database::mydb by public' + - name: Add an audit action + text: az db audit-policy update -g mygroup -s myserver -n mydb + --add auditActionsAndGroups FAILED_DATABASE_AUTHENTICATION_GROUP + - name: Remove an audit action by list index + text: az db audit-policy update -g mygroup -s myserver -n mydb + --add auditActionsAndGroups 0 + - name: Disable an auditing policy + text: az db audit-policy update -g mygroup -s myserver -n mydb + --state Disabled + """ helps['sql db replica'] = """ - type: group - short-summary: Manage replication between databases. - """ + type: group + short-summary: Manage replication between databases. + """ helps['sql db replica create'] = """ - type: command - short-summary: Creates a database as a readable secondary replica of an existing database. - """ + type: command + short-summary: Creates a database as a readable secondary replica of an existing database. + """ helps['sql db replica set-primary'] = """ - type: command - short-summary: Sets which replica database is primary by failing over from the current primary replica database. - """ + type: command + short-summary: Sets which replica database is primary by failing over from the current primary replica database. + """ helps['sql db replica list-links'] = """ - type: command - short-summary: Lists the replicas of a database and corresponding replication status. - """ + type: command + short-summary: Lists the replicas of a database and corresponding replication status. + """ helps['sql db replica delete-link'] = """ - type: command - short-summary: Permanently stops data replication between two database replicas. - """ + type: command + short-summary: Permanently stops data replication between two database replicas. + """ helps['sql db restore'] = """ - type: command - short-summary: Creates a new database by restoring from a database backup. - """ + type: command + short-summary: Creates a new database by restoring from a database backup. + """ helps['sql db threat-detection-policy'] = """ - type: group - short-summary: Manage a database's threat detection policy. - """ + type: group + short-summary: Manage a database's threat detection policy. + """ helps['sql db threat-detection-policy update'] = """ - type: command - short-summary: Updates a database's threat detection policy. - """ + type: command + short-summary: Updates a database's threat detection policy. + long-summary: If the policy is being enabled, storage_account or both storage_endpoint and + storage_account_access_key must be specified. + examples: + - name: Enable by specifying storage account name + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-account mystorage + - name: Enable by specifying storage account name and resource + group + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-account mystorage --storage-resource-group mygroup2 + - name: Enable by specifying storage endpoint and key + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net + --storage-key MYKEY== + - name: Disable a subset of alert types + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --disabled-alerts Sql_Injection_Vulnerability Access_Anomaly + - name: Configure email recipients + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --email-addresses me@examlee.com you@example.com --email-account-admins + Enabled + - name: Disable + text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + --state Disabled + """ # helps['sql db restore-point'] = """ # type: group # short-summary: Manage database restore points. @@ -92,41 +142,41 @@ # short-summary: Manage database service tier advisors. # """ helps['sql dw'] = """ - type: group - short-summary: Manage data warehouses. - """ + type: group + short-summary: Manage data warehouses. + """ helps['sql dw create'] = """ - type: command - short-summary: Creates a data warehouse. - """ + type: command + short-summary: Creates a data warehouse. + """ helps['sql dw delete'] = """ - type: command - short-summary: Deletes a database or data warehouse. - """ + type: command + short-summary: Deletes a database or data warehouse. + """ helps['sql dw list'] = """ - type: command - short-summary: Lists all data warehouses in a server. - """ + type: command + short-summary: Lists all data warehouses in a server. + """ helps['sql dw show'] = """ - type: command - short-summary: Gets a database or data warehouse. - """ + type: command + short-summary: Gets a database or data warehouse. + """ helps['sql dw update'] = """ - type: command - short-summary: Updates a data warehouse. - """ + type: command + short-summary: Updates a data warehouse. + """ helps['sql elastic-pool'] = """ - type: group - short-summary: Manage elastic pools. An elastic pool is an allocation of CPU, IO, and memory resources. Databases inside the pool share these resources. - """ + type: group + short-summary: Manage elastic pools. An elastic pool is an allocation of CPU, IO, and memory resources. Databases inside the pool share these resources. + """ helps['sql elastic-pool create'] = """ - type: command - short-summary: Creates an elastic pool. - """ + type: command + short-summary: Creates an elastic pool. + """ helps['sql elastic-pool update'] = """ - type: command - short-summary: Updates an elastic pool. - """ + type: command + short-summary: Updates an elastic pool. + """ # helps['sql elastic-pool recommended'] = """ # type: group # short-summary: Manages recommended elastic pools. @@ -136,42 +186,42 @@ # short-summary: Manage recommended elastic pool databases. # """ helps['sql server'] = """ - type: group - short-summary: Manage servers. Servers contain databases, data warehouses, and elastic pools. - """ + type: group + short-summary: Manage servers. Servers contain databases, data warehouses, and elastic pools. + """ helps['sql server create'] = """ - type: command - short-summary: Creates a server. - """ + type: command + short-summary: Creates a server. + """ helps['sql server list'] = """ - type: command - short-summary: Lists servers. - """ + type: command + short-summary: Lists servers. + """ helps['sql server update'] = """ - type: command - short-summary: Updates a server. - """ + type: command + short-summary: Updates a server. + """ helps['sql server firewall-rule'] = """ - type: group - short-summary: Manage a server's firewall rules. - """ + type: group + short-summary: Manage a server's firewall rules. + """ # helps['sql server firewall-rule allow-all-azure-ips'] = """ # type: command # short-summary: Create a firewall rule that allows all Azure IP addresses to access the server. # """ helps['sql server firewall-rule create'] = """ - type: command - short-summary: Creates a firewall rule. - """ + type: command + short-summary: Creates a firewall rule. + """ helps['sql server firewall-rule update'] = """ - type: command - short-summary: Updates a firewall rule. - """ + type: command + short-summary: Updates a firewall rule. + """ helps['sql server firewall-rule show'] = """ - type: command - short-summary: Shows the details of a firewall rule. - """ + type: command + short-summary: Shows the details of a firewall rule. + """ helps['sql server firewall-rule list'] = """ - type: command - short-summary: Lists the firewall rules. - """ + type: command + short-summary: Lists the firewall rules. + """ diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 202dc38065f..1a6d229c506 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -15,8 +15,7 @@ BlobAuditingPolicyState, CreateMode, SecurityAlertPolicyState, - SecurityAlertPolicyEmailAccountAdmins, - SecurityAlertPolicyUseServerDefault) + SecurityAlertPolicyEmailAccountAdmins) ##### # Reusable param type definitions @@ -323,62 +322,83 @@ def _configure_db_create_params( ##### -# sql db audit-policy +# sql db audit-policy & threat-detection-policy ##### +def _configure_security_policy_storage_params(cmd): + storage_arg_group = 'Storage' + + cmd.argument('storage_account', + options_list=('--storage-account',), + arg_group=storage_arg_group, + help='Name of the storage account.') + + cmd.argument('storage_resource_group', + options_list=('--storage-resource-group',), + arg_group=storage_arg_group, + help='Resource group containing the storage account. If unspecified, defaults to' + ' the database\'s resource group.') + + cmd.argument('storage_account_access_key', + options_list=('--storage-key',), + arg_group=storage_arg_group, + help='Access key for the storage account.') + + cmd.argument('storage_endpoint', + arg_group=storage_arg_group, + help='The storage account endpoint.') + with ParametersContext(command='sql db audit-policy update') as c: - c.argument('storage_account_access_key', - options_list=('--storage-key',), - help='Access key for the storage account.') + _configure_security_policy_storage_params(c) + + policy_arg_group = 'Policy' - c.argument('storage_endpoint', - help='The storage account endpoint.') + c.argument('state', + arg_group=policy_arg_group, + help='Auditing policy state', + **enum_choice_list(BlobAuditingPolicyState)) c.argument('audit_actions_and_groups', options_list=('--actions',), + arg_group=policy_arg_group, help='List of actions and action groups to audit.', nargs='+') - c.argument('state', - help='Auditing policy state', - **enum_choice_list(BlobAuditingPolicyState)) - c.argument('retention_days', + arg_group=policy_arg_group, help='The number of days to retain audit logs.') -##### -# sql db threat-detection-policy -##### - - with ParametersContext(command='sql db threat-detection-policy update') as c: - c.argument('storage_account_access_key', - options_list=('--storage-key',), - help='Access key for the storage account.') + _configure_security_policy_storage_params(c) - c.argument('storage_endpoint', - help='The storage account endpoint.') + policy_arg_group = 'Policy' + notification_arg_group = 'Notification' c.argument('state', + arg_group=policy_arg_group, help='Threat detection policy state', **enum_choice_list(SecurityAlertPolicyState)) c.argument('retention_days', + arg_group=policy_arg_group, help='The number of days to retain threat detection logs.') - c.argument('email_addresses', - options_list=('--email-addresses',), - help='List of email addresses that alerts are sent to.', - nargs='+') - c.argument('disabled_alerts', + arg_group=policy_arg_group, options_list=('--disabled-alerts',), help='List of disabled alerts.', nargs='+') + c.argument('email_addresses', + arg_group=notification_arg_group, + options_list=('--email-addresses',), + help='List of email addresses that alerts are sent to.', + nargs='+') + c.argument('email_account_admins', + arg_group=notification_arg_group, options_list=('--email-account-admins',), help='Whether the alert is sent to the account administrators.', **enum_choice_list(SecurityAlertPolicyEmailAccountAdmins)) diff --git a/src/command_modules/azure-cli-sql/setup.py b/src/command_modules/azure-cli-sql/setup.py index 9d4387544e8..73acc436cb7 100644 --- a/src/command_modules/azure-cli-sql/setup.py +++ b/src/command_modules/azure-cli-sql/setup.py @@ -25,6 +25,7 @@ DEPENDENCIES = [ 'azure-cli-core', 'azure-mgmt-sql==0.3.3', + 'azure-mgmt-storage==0.31.0', 'six' ] diff --git a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml index dd54642fe80..e60333ec037 100644 --- a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml +++ b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml @@ -20,15 +20,42 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 03:12:50 GMT'] + date: ['Thu, 16 Mar 2017 22:58:22 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 201, message: Created} +- request: + body: '{"tags": {"use": "az-test"}, "location": "westus"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['50'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000002?api-version=2016-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002","name":"clitest.rg000002","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['326'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 22:58:25 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] status: {code: 201, message: Created} - request: - body: '{"properties": {"administratorLoginPassword": "SecretPassword123", "administratorLogin": - "admin123"}, "location": "westus"}' + body: '{"location": "westus", "properties": {"administratorLoginPassword": "SecretPassword123", + "administratorLogin": "admin123"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -40,24 +67,24 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002","name":"clitestserver000002","type":"Microsoft.Sql/servers","location":"West - US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000002.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":"SecretPassword123","externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003","name":"clitestserver000003","type":"Microsoft.Sql/servers","location":"West + US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000003.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":"SecretPassword123","externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['695'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:13:40 GMT'] + date: ['Thu, 16 Mar 2017 22:59:00 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 201, message: Created} - request: - body: '{"kind": "Storage", "location": "westus", "sku": {"name": "Standard_LRS"}}' + body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "location": "westus"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -69,20 +96,20 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004?api-version=2016-12-01 response: body: {string: ''} headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 03:13:42 GMT'] + date: ['Thu, 16 Mar 2017 22:59:03 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/767e787a-4283-47b1-ac84-079ffbedad8d?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/e4cd629b-9f55-4798-aeaa-61255d95e452?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 202, message: Accepted} - request: body: null @@ -96,16 +123,99 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/767e787a-4283-47b1-ac84-079ffbedad8d?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/e4cd629b-9f55-4798-aeaa-61255d95e452?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T03:13:42.9268635Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-16T22:59:03.8066607Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 03:14:00 GMT'] + date: ['Thu, 16 Mar 2017 22:59:22 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "location": "westus"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Length: ['74'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 16 Mar 2017 22:59:26 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01'] + pragma: [no-cache] + retry-after: ['17'] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 16 Mar 2017 22:59:44 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01'] + pragma: [no-cache] + retry-after: ['17'] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:01 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -125,16 +235,16 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003","kind":"Storage","location":"westus","name":"clitest000003","properties":{"creationTime":"2017-03-16T03:13:42.9268635Z","primaryEndpoints":{"blob":"https://clitest000003.blob.core.windows.net/","file":"https://clitest000003.file.core.windows.net/","queue":"https://clitest000003.queue.core.windows.net/","table":"https://clitest000003.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-16T22:59:03.8066607Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 03:14:03 GMT'] + date: ['Thu, 16 Mar 2017 23:00:03 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -155,23 +265,23 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000003/listKeys?api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg=="},{"keyName":"key2","permissions":"Full","value":"ykjln4WQcc+CUfH9zdEiCuLsk9StFwzoEwjWzA3oF8LOUFfBJWa4lpK80auj1DNB8vs64/3quSX55nADaciQJA=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA=="},{"keyName":"key2","permissions":"Full","value":"GOvNSiKFr0rYZUNLn49SEXU2PjXgrNFfG9JYA6CRy0zySLICbBQ0nBgB+pkp/t3LE9mSsjRx7oTMYTpEG4X8Ng=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 03:14:05 GMT'] + date: ['Thu, 16 Mar 2017 23:00:05 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 200, message: OK} - request: body: null @@ -185,16 +295,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002","name":"clitestserver000002","type":"Microsoft.Sql/servers","location":"West - US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000002.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":null,"externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003","name":"clitestserver000003","type":"Microsoft.Sql/servers","location":"West + US","kind":"v12.0","properties":{"fullyQualifiedDomainName":"clitestserver000003.database.windows.net","administratorLogin":"admin123","administratorLoginPassword":null,"externalAdministratorLogin":null,"externalAdministratorSid":null,"version":"12.0","state":"Ready"}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['680'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:14:07 GMT'] + date: ['Thu, 16 Mar 2017 23:00:07 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -214,23 +324,23 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: - body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489634047590+0000)\/"}'} + body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489705208528+0000)\/"}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['80'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:14:08 GMT'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/operationResults/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] + date: ['Thu, 16 Mar 2017 23:00:09 GMT'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/operationResults/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] preference-applied: [return-content] retry-after: ['30'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 202, message: Accepted} - request: body: null @@ -244,16 +354,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview response: - body: {string: '{"operationId":"64984912-f2cd-418d-ab31-bc69a933f1e6","status":"InProgress","error":null}'} + body: {string: '{"operationId":"7bee719d-ff38-48a4-8337-c8fd14c1ddb1","status":"Succeeded","error":null}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] - content-length: ['89'] + content-length: ['88'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:14:40 GMT'] + date: ['Thu, 16 Mar 2017 23:00:39 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -272,16 +382,17 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: - body: {string: '{"operationId":"64984912-f2cd-418d-ab31-bc69a933f1e6","status":"Succeeded","error":null}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West + US","kind":"v12.0,user","properties":{"databaseId":"95c1f24e-3edc-4989-9eda-6a855095bde0","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T23:00:08.73Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East + US","earliestRestoreDate":"2017-03-16T23:10:38.2Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/azureAsyncOperation/64984912-f2cd-418d-ab31-bc69a933f1e6?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] - content-length: ['88'] + content-length: ['997'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:15:12 GMT'] + date: ['Thu, 16 Mar 2017 23:00:40 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -293,50 +404,48 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db create] + CommandName: [sql db audit-policy show] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West - US","kind":"v12.0,user","properties":{"databaseId":"2bfa7a38-5cd0-45d1-938f-617978e4ce4b","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T03:14:07.81Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East - US","earliestRestoreDate":"2017-03-16T03:24:46.817Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} headers: - cache-control: ['no-store, no-cache'] - content-length: ['999'] - content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] - dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:15:12 GMT'] + cache-control: [no-cache] + content-length: ['618'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:00:42 GMT'] + expires: ['-1'] + pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db audit-policy show] + CommandName: [sql db audit-policy update] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} headers: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 03:15:16 GMT'] + date: ['Thu, 16 Mar 2017 23:00:43 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -344,6 +453,66 @@ interactions: transfer-encoding: [chunked] vary: [Accept-Encoding] status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"state": "Enabled", "isStorageSecondaryKeyInUse": false, + "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageEndpoint": "https://clitest000004.blob.core.windows.net/", "storageAccountAccessKey": + "ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA==", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Length: ['452'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['732'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:00:44 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:46 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} - request: body: null headers: @@ -356,14 +525,14 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0,"auditActionsAndGroups":[],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} headers: cache-control: [no-cache] - content-length: ['618'] + content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 03:15:19 GMT'] + date: ['Thu, 16 Mar 2017 23:00:47 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -372,11 +541,71 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], - "state": "Enabled", "isStorageSecondaryKeyInUse": false, "storageAccountAccessKey": - "NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==", - "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", "storageEndpoint": - "https://clitest000003.blob.core.windows.net/", "retentionDays": 30}}''' + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:48 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 + response: + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + + '} + headers: + cache-control: [no-cache] + content-length: ['289'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:49 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"state": "Enabled", "isStorageSecondaryKeyInUse": false, + "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": + "p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A==", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -388,20 +617,81 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} headers: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 03:15:25 GMT'] + date: ['Thu, 16 Mar 2017 23:00:49 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] - status: {code: 201, message: Created} + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1194'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['732'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:00:51 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"state": "Disabled", "isStorageSecondaryKeyInUse": false, + "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": + "", "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Length: ['365'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['733'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:00:52 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 200, message: OK} - request: body: null headers: @@ -414,16 +704,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West US","kind":null,"properties":{"useServerDefault":"Enabled","state":"New","disabledAlerts":"Preview","emailAddresses":"","emailAccountAdmins":"Enabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:15:26 GMT'] + date: ['Thu, 16 Mar 2017 23:00:53 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -442,16 +732,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West US","kind":null,"properties":{"useServerDefault":"Enabled","state":"New","disabledAlerts":"Preview","emailAddresses":"","emailAccountAdmins":"Enabled","storageEndpoint":"","storageAccountAccessKey":"","retentionDays":0}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:15:28 GMT'] + date: ['Thu, 16 Mar 2017 23:00:55 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -459,11 +749,10 @@ interactions: x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", - "emailAddresses": "test1@example.com;test2@example.com", "useServerDefault": - "Enabled", "emailAccountAdmins": "Enabled", "storageAccountAccessKey": "NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==", - "retentionDays": 30, "storageEndpoint": "https://clitest000003.blob.core.windows.net/", - "state": "Enabled"}}''' + body: 'b''{"properties": {"emailAddresses": "test1@example.com;test2@example.com", + "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", + "emailAccountAdmins": "Enabled", "retentionDays": 30, "storageEndpoint": "https://clitest000004.blob.core.windows.net/", + "useServerDefault": "Enabled", "storageAccountAccessKey": "ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA=="}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -475,15 +764,15 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000002/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000003.blob.core.windows.net/","storageAccountAccessKey":"NMgP+rSGzEqvm1a1MrtXiHoJAtnGW4Csm7ZimkfaGV89V6uhyY+fpKIRJkM00hlTC4ZcQtyQpK5wR8rTVFrsqg==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['834'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 03:15:34 GMT'] + date: ['Thu, 16 Mar 2017 23:00:56 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -492,6 +781,245 @@ interactions: x-content-type-options: [nosniff] x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [storage account keys list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 + response: + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + + '} + headers: + cache-control: [no-cache] + content-length: ['289'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:57 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":"West + US","kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['752'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 23:00:59 GMT'] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} + headers: + cache-control: [no-cache] + content-length: ['827'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:00:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 + response: + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + + '} + headers: + cache-control: [no-cache] + content-length: ['289'] + content-type: [application/json] + date: ['Thu, 16 Mar 2017 23:01:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"emailAddresses": "test1@example.com;test2@example.com", + "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", + "emailAccountAdmins": "Enabled", "retentionDays": 30, "storageEndpoint": "https://clitest000005.blob.core.windows.net/", + "useServerDefault": "Disabled", "storageAccountAccessKey": "p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Length: ['440'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A==","retentionDays":30}}'} + headers: + cache-control: ['no-store, no-cache'] + content-length: ['835'] + content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] + dataserviceversion: [3.0;] + date: ['Thu, 16 Mar 2017 23:01:02 GMT'] + preference-applied: [return-content] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['733'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:01:03 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} +- request: + body: 'b''{"properties": {"state": "Disabled", "isStorageSecondaryKeyInUse": false, + "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": + "", "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Length: ['365'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/default?api-version=2015-05-01-preview + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/auditingSettings/Default","name":"Default","type":"Microsoft.Sql/servers/databases/auditingSettings","kind":"","properties":{"state":"Disabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"","retentionDays":30,"auditActionsAndGroups":["DATABASE_LOGOUT_GROUP","DATABASE_ROLE_MEMBER_CHANGE_GROUP"],"storageAccountSubscriptionId":"00000000-0000-0000-0000-000000000000","isStorageSecondaryKeyInUse":false}}'} + headers: + cache-control: [no-cache] + content-length: ['733'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 16 Mar 2017 23:01:03 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-HTTPAPI/2.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-ms-ratelimit-remaining-subscription-writes: ['1193'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000002?api-version=2016-09-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Thu, 16 Mar 2017 23:01:05 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdEMkQxOTBERkNGQzA5RDhFMDE5ODA0NTI0QjQ0OTE1OEY5MXxCQTVBQUZGODZCREUwNkM3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + pragma: [no-cache] + retry-after: ['15'] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 202, message: Accepted} - request: body: null headers: @@ -512,9 +1040,9 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 03:15:35 GMT'] + date: ['Thu, 16 Mar 2017 23:01:07 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkc0N0ZEQzU5RDZDQjJGMTE2NDUxREFBMDhGM0U5NEFDNjVCMXw5NzlEQzFCNEM5ODgxNjU3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkc0MTgxNDE4NEJDODA5NjIxQTQ5QUJEOUNEODY0MjMyQ0M3Qnw5MEE1NDc0RTY1RDcyMENFLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index 70cf96b3af9..6ec6ef87854 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -397,21 +397,29 @@ def test_sql_db_restore(self, resource_group, resource_group_location, server): class SqlServerDbSecurityScenarioTest(ScenarioTest): + def _get_storage_endpoint(self, storage_account, resource_group): + return self.cmd('storage account show -g {} -n {}' + ' --query primaryEndpoints.blob' + .format(resource_group, storage_account)).get_output_in_json() + + def _get_storage_key(self, storage_account, resource_group): + return self.cmd('storage account keys list -g {} -n {} --query [0].value' + .format(resource_group, storage_account)).get_output_in_json() + @ResourceGroupPreparer() + @ResourceGroupPreparer(parameter_name='resource_group_2') @SqlServerPreparer() @StorageAccountPreparer() - def test_sql_db_security_mgmt(self, resource_group, resource_group_location, server, - storage_account): + @StorageAccountPreparer(parameter_name='storage_account_2', + resource_group_parameter_name='resource_group_2') + def test_sql_db_security_mgmt(self, resource_group, resource_group_2, + resource_group_location, server, + storage_account, storage_account_2): database_name = "cliautomationdb01" - # get storage account endpoint - storage_endpoint = self.cmd('storage account show -g {} -n {}' - ' --query primaryEndpoints.blob' - .format(resource_group, storage_account)).get_output_in_json() - - # get storage account key - key = self.cmd('storage account keys list -g {} -n {} --query [0].value' - .format(resource_group, storage_account)).get_output_in_json() + # get storage account endpoint and key + storage_endpoint = self._get_storage_endpoint(storage_account, resource_group) + key = self._get_storage_key(storage_account, resource_group) # create db self.cmd('sql db create -g {} -s {} -n {}' @@ -426,9 +434,9 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser .format(resource_group, server, database_name), checks=[JMESPathCheck('resourceGroup', resource_group)]) - # update audit policy - state = 'Enabled' - access_key = key + # update audit policy - enable + state_enabled = 'Enabled' + key retention_days = 30 audit_actions_input = 'DATABASE_LOGOUT_GROUP DATABASE_ROLE_MEMBER_CHANGE_GROUP' audit_actions_expected = ['DATABASE_LOGOUT_GROUP', @@ -437,22 +445,48 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser self.cmd('sql db audit-policy update -g {} -s {} -n {}' ' --state {} --storage-key {} --storage-endpoint={}' ' --retention-days={} --actions {}' - .format(resource_group, server, database_name, state, access_key, + .format(resource_group, server, database_name, state_enabled, key, storage_endpoint, retention_days, audit_actions_input), checks=[ JMESPathCheck('resourceGroup', resource_group), - JMESPathCheck('state', state), + JMESPathCheck('state', state_enabled), JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it JMESPathCheck('storageEndpoint', storage_endpoint), JMESPathCheck('retentionDays', retention_days), JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) + # update audit policy - specify storage account and resource group. use secondary key + storage_endpoint_2 = self._get_storage_endpoint(storage_account_2, resource_group_2) + self.cmd('sql db audit-policy update -g {} -s {} -n {} --storage-account {}' + ' --storage-resource-group {}' + .format(resource_group, server, database_name, storage_account_2, + resource_group_2), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state_enabled), + JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it + JMESPathCheck('storageEndpoint', storage_endpoint_2), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) + + # update audit policy - disable + state_disabled = 'Disabled' + self.cmd('sql db audit-policy update -g {} -s {} -n {} --state {}' + .format(resource_group, server, database_name, state_disabled), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state_disabled), + JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it + JMESPathCheck('storageEndpoint', storage_endpoint_2), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) + # get threat detection policy self.cmd('sql db threat-detection-policy show -g {} -s {} -n {}' .format(resource_group, server, database_name), checks=[JMESPathCheck('resourceGroup', resource_group)]) - # update threat detection policy + # update threat detection policy - enable disabled_alerts_input = 'Sql_Injection_Vulnerability Access_Anomaly' disabled_alerts_expected = 'Sql_Injection_Vulnerability;Access_Anomaly' email_addresses_input = 'test1@example.com test2@example.com' @@ -463,19 +497,46 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_location, ser ' --state {} --storage-key {} --storage-endpoint {}' ' --retention-days {} --email-addresses {} --disabled-alerts {}' ' --email-account-admins {}' - .format(resource_group, server, database_name, state, access_key, + .format(resource_group, server, database_name, state_enabled, key, storage_endpoint, retention_days, email_addresses_input, disabled_alerts_input, email_account_admins), checks=[ JMESPathCheck('resourceGroup', resource_group), - JMESPathCheck('state', state), - JMESPathCheck('storageAccountAccessKey', access_key), + JMESPathCheck('state', state_enabled), + JMESPathCheck('storageAccountAccessKey', key), JMESPathCheck('storageEndpoint', storage_endpoint), JMESPathCheck('retentionDays', retention_days), JMESPathCheck('emailAddresses', email_addresses_expected), JMESPathCheck('disabledAlerts', disabled_alerts_expected), JMESPathCheck('emailAccountAdmins', email_account_admins)]) + # update threat policy - specify storage account and resource group. use secondary key + key_2 = self._get_storage_key(storage_account_2, resource_group_2) + self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' + ' --storage-account {} --storage-resource-group {}' + .format(resource_group, server, database_name, storage_account_2, + resource_group_2), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state_enabled), + JMESPathCheck('storageAccountAccessKey', key_2), + JMESPathCheck('storageEndpoint', storage_endpoint_2), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('emailAddresses', email_addresses_expected), + JMESPathCheck('disabledAlerts', disabled_alerts_expected), + JMESPathCheck('emailAccountAdmins', email_account_admins)]) + + # update threat policy - disable + self.cmd('sql db audit-policy update -g {} -s {} -n {} --state {}' + .format(resource_group, server, database_name, state_disabled), + checks=[ + JMESPathCheck('resourceGroup', resource_group), + JMESPathCheck('state', state_disabled), + JMESPathCheck('storageAccountAccessKey', ''), # service doesn't return it + JMESPathCheck('storageEndpoint', storage_endpoint_2), + JMESPathCheck('retentionDays', retention_days), + JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) + class SqlServerDwMgmtScenarioTest(ScenarioTest): # pylint: disable=too-many-instance-attributes From 335234c078f40922ca243b0a5772c4fe9584ea27 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 16 Mar 2017 16:09:08 -0700 Subject: [PATCH 11/19] flake8 warning --- .../azure-cli-sql/azure/cli/command_modules/sql/custom.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index dfede353a44..7c81b16f0df 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -379,6 +379,7 @@ def _get_storage_key( index = 1 if use_secondary_key else 0 return keys.keys[index].value # pylint: disable=no-member + # Common code for updating audit and threat detection policy def _db_security_policy_update( # pylint: disable=too-many-arguments instance, From 0b05fad18292ef407bedc195363d5bb2ed2de598 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 16 Mar 2017 17:53:12 -0700 Subject: [PATCH 12/19] Removed --storage-resource-group param. Use ARM lookup instead. This is a lot of custom code, but without it the customer experience is bad. --- .../azure/cli/command_modules/sql/custom.py | 43 ++- .../azure/cli/command_modules/sql/help.py | 4 +- .../azure/cli/command_modules/sql/params.py | 6 - .../recordings/test_sql_db_security_mgmt.yaml | 276 +++++++++++------- .../azure-cli-sql/tests/test_sql_commands.py | 4 +- 5 files changed, 197 insertions(+), 136 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index 7c81b16f0df..13f6d38d0c7 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -20,6 +20,7 @@ SecurityAlertPolicyState, ServiceObjectiveName ) +from azure.mgmt.resource.resources import ResourceManagementClient from azure.mgmt.storage import StorageManagementClient # url parse package has different names in Python 2 and 3. 'six' package works cross-version. @@ -342,6 +343,32 @@ def db_update( ##### +# Finds a storage account's resource group by querying ARM resource cache. +# Why do we have to do this: so we know the resource group in order to later query the storage API +# to determine the account's keys and endpoint. Why isn't this just a command line parameter: +# because if it was a command line parameter then the customer would need to specify storage +# resource group just to update some unrelated property, which is annoying and makes no sense to +# the customer. +def _find_storage_account(name): + resource_type = 'Microsoft.Storage/storageAccounts' + + client = get_mgmt_service_client(ResourceManagementClient) + resources = list(client.resources.list( + filter="name eq '{}' and resourceType eq '{}'" + .format(name, resource_type))) + + if len(resources) == 0: + raise CLIError('No resource with name {} and type {} was found.' + .format(name, resource_type)) + + if len(resources) > 1: + raise CLIError('Multiple resources with name {} and type {} were found.' + .format(name, resource_type)) + + # Split the uri and return just the resource group + return resources[0].id.split('/')[4] + + # Determines storage account name from endpoint url string. # e.g. 'https://mystorage.blob.core.windows.net' -> 'mystorage' def _get_storage_account_name(storage_endpoint): @@ -383,10 +410,8 @@ def _get_storage_key( # Common code for updating audit and threat detection policy def _db_security_policy_update( # pylint: disable=too-many-arguments instance, - resource_group_name, enabled, storage_account, - storage_resource_group, storage_endpoint, storage_account_access_key, use_secondary_key): @@ -394,15 +419,12 @@ def _db_security_policy_update( # pylint: disable=too-many-arguments # Validate storage endpoint arguments if storage_endpoint is not None and storage_account is not None: raise CLIError('--storage-endpoint and --storage-account cannot both be specified.') - if storage_resource_group is not None and storage_account is None: - raise CLIError('If --storage-resource-group is specified, --storage-account must be' - ' specified.') # Set storage endpoint - storage_resource_group = storage_resource_group or resource_group_name if storage_endpoint is not None: instance.storage_endpoint = storage_endpoint if storage_account is not None: + storage_resource_group = _find_storage_account(storage_account) instance.storage_endpoint = _get_storage_endpoint(storage_account, storage_resource_group) # Set storage access key @@ -420,6 +442,7 @@ def _db_security_policy_update( # pylint: disable=too-many-arguments # function, but at least we tried. if storage_account is None: storage_account = _get_storage_account_name(instance.storage_endpoint) + storage_resource_group = _find_storage_account(storage_account) instance.storage_account_access_key = _get_storage_key( storage_account, @@ -430,10 +453,8 @@ def _db_security_policy_update( # pylint: disable=too-many-arguments # Update audit policy. Custom update function to apply parameters to instance. def db_audit_policy_update( # pylint: disable=too-many-arguments instance, - resource_group_name, state=None, storage_account=None, - storage_resource_group=None, storage_endpoint=None, storage_account_access_key=None, audit_actions_and_groups=None, @@ -448,10 +469,8 @@ def db_audit_policy_update( # pylint: disable=too-many-arguments # Set storage-related properties _db_security_policy_update( instance, - resource_group_name, enabled, storage_account, - storage_resource_group, storage_endpoint, storage_account_access_key, instance.is_storage_secondary_key_in_use) @@ -469,10 +488,8 @@ def db_audit_policy_update( # pylint: disable=too-many-arguments # Update threat detection policy. Custom update function to apply parameters to instance. def db_threat_detection_policy_update( # pylint: disable=too-many-arguments instance, - resource_group_name, state=None, storage_account=None, - storage_resource_group=None, storage_endpoint=None, storage_account_access_key=None, retention_days=None, @@ -489,10 +506,8 @@ def db_threat_detection_policy_update( # pylint: disable=too-many-arguments # Set storage-related properties _db_security_policy_update( instance, - resource_group_name, enabled, storage_account, - storage_resource_group, storage_endpoint, storage_account_access_key, False) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index ba96dad183a..cab91b25398 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -55,7 +55,7 @@ - name: Enable an auditing policy by specifying storage account name and resource group text: az db audit-policy update -g mygroup -s myserver -n mydb - --state Enabled --storage-account mystorage --storage-resource-group mygroup2 + --state Enabled --storage-account mystorage - name: Enable an auditing policy by specifying storage endpoint and key text: az db audit-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net @@ -113,7 +113,7 @@ - name: Enable by specifying storage account name and resource group text: az db threat-detection-policy update -g mygroup -s myserver -n mydb - --state Enabled --storage-account mystorage --storage-resource-group mygroup2 + --state Enabled --storage-account mystorage - name: Enable by specifying storage endpoint and key text: az db threat-detection-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 1a6d229c506..c87066a9c45 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -333,12 +333,6 @@ def _configure_security_policy_storage_params(cmd): arg_group=storage_arg_group, help='Name of the storage account.') - cmd.argument('storage_resource_group', - options_list=('--storage-resource-group',), - arg_group=storage_arg_group, - help='Resource group containing the storage account. If unspecified, defaults to' - ' the database\'s resource group.') - cmd.argument('storage_account_access_key', options_list=('--storage-key',), arg_group=storage_arg_group, diff --git a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml index e60333ec037..7ce35826ad5 100644 --- a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml +++ b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"tags": {"use": "az-test"}, "location": "westus"}' + body: '{"location": "westus", "tags": {"use": "az-test"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -20,14 +20,14 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 22:58:22 GMT'] + date: ['Fri, 17 Mar 2017 00:42:04 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 201, message: Created} - request: - body: '{"tags": {"use": "az-test"}, "location": "westus"}' + body: '{"location": "westus", "tags": {"use": "az-test"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -47,11 +47,11 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 22:58:25 GMT'] + date: ['Fri, 17 Mar 2017 00:42:06 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 201, message: Created} - request: body: '{"location": "westus", "properties": {"administratorLoginPassword": "SecretPassword123", @@ -76,15 +76,15 @@ interactions: content-length: ['695'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 22:59:00 GMT'] + date: ['Fri, 17 Mar 2017 00:42:32 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1193'] status: {code: 201, message: Created} - request: - body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "location": "westus"}' + body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -102,14 +102,14 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 22:59:03 GMT'] + date: ['Fri, 17 Mar 2017 00:42:38 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/e4cd629b-9f55-4798-aeaa-61255d95e452?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/d140f0c3-f2f2-4503-a424-0d358a2d6f87?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 202, message: Accepted} - request: body: null @@ -123,16 +123,16 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/e4cd629b-9f55-4798-aeaa-61255d95e452?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/d140f0c3-f2f2-4503-a424-0d358a2d6f87?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-16T22:59:03.8066607Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-17T00:42:34.6000701Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 22:59:22 GMT'] + date: ['Fri, 17 Mar 2017 00:42:56 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -141,7 +141,7 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: '{"sku": {"name": "Standard_LRS"}, "kind": "Storage", "location": "westus"}' + body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -159,14 +159,14 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 22:59:26 GMT'] + date: ['Fri, 17 Mar 2017 00:43:03 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 202, message: Accepted} - request: body: null @@ -180,15 +180,15 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01 response: body: {string: ''} headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 22:59:44 GMT'] + date: ['Fri, 17 Mar 2017 00:43:22 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -206,16 +206,16 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/c9c689cb-a704-46a2-b6d7-baf2233dc4df?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:01 GMT'] + date: ['Fri, 17 Mar 2017 00:43:40 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -237,14 +237,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-16T22:59:03.8066607Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-17T00:42:34.6000701Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:03 GMT'] + date: ['Fri, 17 Mar 2017 00:43:41 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -267,21 +267,21 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA=="},{"keyName":"key2","permissions":"Full","value":"GOvNSiKFr0rYZUNLn49SEXU2PjXgrNFfG9JYA6CRy0zySLICbBQ0nBgB+pkp/t3LE9mSsjRx7oTMYTpEG4X8Ng=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw=="},{"keyName":"key2","permissions":"Full","value":"qUwBXMfDYdtLd1eoTQzS0rRxThbB2YzrdyJW+Vm1ZmeGEIw+4ZtH15+HHuTsjy0eFDneCI4vQZSAEN0Ehog2mA=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:05 GMT'] + date: ['Fri, 17 Mar 2017 00:43:44 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -304,7 +304,7 @@ interactions: content-length: ['680'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:07 GMT'] + date: ['Fri, 17 Mar 2017 00:43:46 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -326,21 +326,21 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: - body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489705208528+0000)\/"}'} + body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489711430032+0000)\/"}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['80'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:09 GMT'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/operationResults/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] + date: ['Fri, 17 Mar 2017 00:43:47 GMT'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/operationResults/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] preference-applied: [return-content] retry-after: ['30'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] status: {code: 202, message: Accepted} - request: body: null @@ -354,16 +354,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview response: - body: {string: '{"operationId":"7bee719d-ff38-48a4-8337-c8fd14c1ddb1","status":"Succeeded","error":null}'} + body: {string: '{"operationId":"6e2cc577-266a-4bea-b623-9a9f40f660e9","status":"Succeeded","error":null}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/7bee719d-ff38-48a4-8337-c8fd14c1ddb1?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['88'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:39 GMT'] + date: ['Fri, 17 Mar 2017 00:44:17 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -385,14 +385,14 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West - US","kind":"v12.0,user","properties":{"databaseId":"95c1f24e-3edc-4989-9eda-6a855095bde0","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-16T23:00:08.73Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East - US","earliestRestoreDate":"2017-03-16T23:10:38.2Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} + US","kind":"v12.0,user","properties":{"databaseId":"1912e921-0ad8-4a85-8acf-6384b8069293","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-17T00:43:50.223Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East + US","earliestRestoreDate":"2017-03-17T00:54:19.697Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} headers: cache-control: ['no-store, no-cache'] - content-length: ['997'] + content-length: ['1000'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:40 GMT'] + date: ['Fri, 17 Mar 2017 00:44:19 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -418,7 +418,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:42 GMT'] + date: ['Fri, 17 Mar 2017 00:44:20 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -445,7 +445,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:43 GMT'] + date: ['Fri, 17 Mar 2017 00:44:21 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -454,11 +454,11 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"state": "Enabled", "isStorageSecondaryKeyInUse": false, - "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", - "storageEndpoint": "https://clitest000004.blob.core.windows.net/", "storageAccountAccessKey": - "ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA==", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": + "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Enabled", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + "storageAccountAccessKey": "7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==", + "storageEndpoint": "https://clitest000004.blob.core.windows.net/"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -477,12 +477,12 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:44 GMT'] + date: ['Fri, 17 Mar 2017 00:44:24 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: body: null @@ -498,14 +498,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:46 GMT'] + date: ['Fri, 17 Mar 2017 00:44:26 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -532,7 +532,7 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:47 GMT'] + date: ['Fri, 17 Mar 2017 00:44:28 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -540,6 +540,32 @@ interactions: transfer-encoding: [chunked] vary: [Accept-Encoding] status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db audit-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=name%20eq%20%27clitest000005%27%20and%20resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27&api-version=2016-09-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","name":"clitest000005","type":"Microsoft.Storage/storageAccounts","sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","location":"westus","tags":{}}]}'} + headers: + cache-control: [no-cache] + content-length: ['403'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 17 Mar 2017 00:44:28 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} - request: body: null headers: @@ -554,14 +580,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:48 GMT'] + date: ['Fri, 17 Mar 2017 00:44:29 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -584,28 +610,28 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:49 GMT'] + date: ['Fri, 17 Mar 2017 00:44:29 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1192'] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"state": "Enabled", "isStorageSecondaryKeyInUse": false, - "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", - "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": - "p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A==", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": + "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Enabled", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + "storageAccountAccessKey": "8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==", + "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -624,14 +650,14 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:49 GMT'] + date: ['Fri, 17 Mar 2017 00:44:34 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1194'] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] status: {code: 200, message: OK} - request: body: null @@ -652,7 +678,7 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:51 GMT'] + date: ['Fri, 17 Mar 2017 00:44:36 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -661,10 +687,10 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"state": "Disabled", "isStorageSecondaryKeyInUse": false, - "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", - "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": - "", "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": + "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Disabled", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + "storageAccountAccessKey": "", "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -683,14 +709,14 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:00:52 GMT'] + date: ['Fri, 17 Mar 2017 00:44:38 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -713,7 +739,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:53 GMT'] + date: ['Fri, 17 Mar 2017 00:44:39 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -741,7 +767,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:55 GMT'] + date: ['Fri, 17 Mar 2017 00:44:41 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -749,10 +775,11 @@ interactions: x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"emailAddresses": "test1@example.com;test2@example.com", + body: 'b''{"properties": {"storageAccountAccessKey": "7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==", + "retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", - "emailAccountAdmins": "Enabled", "retentionDays": 30, "storageEndpoint": "https://clitest000004.blob.core.windows.net/", - "useServerDefault": "Enabled", "storageAccountAccessKey": "ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA=="}}''' + "emailAccountAdmins": "Enabled", "storageEndpoint": "https://clitest000004.blob.core.windows.net/", + "useServerDefault": "Enabled"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -766,20 +793,20 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"ZWlZM7kxcWov5xyKsn+BQmwkRzNdEeO1Uhy8BEt0beEEGa0fhyXNmdlzLy85LrQ81NCeLoRa6oZj01nyr2KmWA==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['834'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:56 GMT'] + date: ['Fri, 17 Mar 2017 00:44:45 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1194'] status: {code: 200, message: OK} - request: body: null @@ -796,21 +823,21 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:57 GMT'] + date: ['Fri, 17 Mar 2017 00:44:46 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -833,13 +860,39 @@ interactions: content-length: ['752'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:00:59 GMT'] + date: ['Fri, 17 Mar 2017 00:44:47 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [sql db threat-detection-policy update] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 + msrest_azure/0.4.7 resourcemanagementclient/0.30.2 Azure-SDK-For-Python + AZURECLI/2.0.1+dev] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=name%20eq%20%27clitest000005%27%20and%20resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27&api-version=2016-09-01 + response: + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","name":"clitest000005","type":"Microsoft.Storage/storageAccounts","sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","location":"westus","tags":{}}]}'} + headers: + cache-control: [no-cache] + content-length: ['403'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 17 Mar 2017 00:44:48 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + status: {code: 200, message: OK} - request: body: null headers: @@ -854,14 +907,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-16T22:59:26.0047928Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:00:59 GMT'] + date: ['Fri, 17 Mar 2017 00:44:48 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -884,27 +937,28 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="},{"keyName":"key2","permissions":"Full","value":"ZxRkrMhuz/G/7k8Y7E+SIE5qhVKDiLGyPSMKwxX/VuOT4f1S4/YAv0PqmkNmG5cLG9OEvVkXRIZtBTJoQE9Vnw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Thu, 16 Mar 2017 23:01:00 GMT'] + date: ['Fri, 17 Mar 2017 00:44:49 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1193'] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"emailAddresses": "test1@example.com;test2@example.com", + body: 'b''{"properties": {"storageAccountAccessKey": "8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==", + "retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", - "emailAccountAdmins": "Enabled", "retentionDays": 30, "storageEndpoint": "https://clitest000005.blob.core.windows.net/", - "useServerDefault": "Disabled", "storageAccountAccessKey": "p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A=="}}''' + "emailAccountAdmins": "Enabled", "storageEndpoint": "https://clitest000005.blob.core.windows.net/", + "useServerDefault": "Disabled"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -918,20 +972,20 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"p6KdxBo2H1WaFKUBxfxuW86d2GQVltQX+qPk3CC9MF2cC7t84CLElMdHgJwJGaGIZc+MZnQj1/AQq/HhzXiS9A==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['835'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Thu, 16 Mar 2017 23:01:02 GMT'] + date: ['Fri, 17 Mar 2017 00:44:53 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -952,7 +1006,7 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:01:03 GMT'] + date: ['Fri, 17 Mar 2017 00:44:56 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -961,10 +1015,10 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"state": "Disabled", "isStorageSecondaryKeyInUse": false, - "retentionDays": 30, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", - "storageEndpoint": "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": - "", "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"]}}''' + body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": + "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Disabled", + "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + "storageAccountAccessKey": "", "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -983,14 +1037,14 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Thu, 16 Mar 2017 23:01:03 GMT'] + date: ['Fri, 17 Mar 2017 00:44:58 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1193'] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] status: {code: 200, message: OK} - request: body: null @@ -1012,13 +1066,13 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 23:01:05 GMT'] + date: ['Fri, 17 Mar 2017 00:45:02 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdEMkQxOTBERkNGQzA5RDhFMDE5ODA0NTI0QjQ0OTE1OEY5MXxCQTVBQUZGODZCREUwNkM3LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdFMTQxMEZFRjU2QkFDMjhBNEEyQkY0QzlFRjQ4QTQ1ODYyNHwwNDIyRTZCNjg0OTE4OTVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 202, message: Accepted} - request: body: null @@ -1040,12 +1094,12 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Thu, 16 Mar 2017 23:01:07 GMT'] + date: ['Fri, 17 Mar 2017 00:45:03 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkc0MTgxNDE4NEJDODA5NjIxQTQ5QUJEOUNEODY0MjMyQ0M3Qnw5MEE1NDc0RTY1RDcyMENFLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkcxN0Q0Q0RBNkM1MEU5QTRFRkNDNUY3NkJEODRDQUIwNkNCMHxGRTdDQkJFQTk3NjNBQkQ4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} version: 1 diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index 6ec6ef87854..d5ae02a4199 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -458,7 +458,6 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_2, # update audit policy - specify storage account and resource group. use secondary key storage_endpoint_2 = self._get_storage_endpoint(storage_account_2, resource_group_2) self.cmd('sql db audit-policy update -g {} -s {} -n {} --storage-account {}' - ' --storage-resource-group {}' .format(resource_group, server, database_name, storage_account_2, resource_group_2), checks=[ @@ -512,8 +511,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_2, # update threat policy - specify storage account and resource group. use secondary key key_2 = self._get_storage_key(storage_account_2, resource_group_2) - self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' - ' --storage-account {} --storage-resource-group {}' + self.cmd('sql db threat-detection-policy update -g {} -s {} -n {} --storage-account {}' .format(resource_group, server, database_name, storage_account_2, resource_group_2), checks=[ From a244010b1e497d8ae2f2ceada1a22fd0dae38a77 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 16 Mar 2017 18:12:47 -0700 Subject: [PATCH 13/19] Fixed examples --- .../azure/cli/command_modules/sql/help.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index cab91b25398..a50977e1c86 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -49,14 +49,10 @@ long-summary: If the policy is being enabled, storage_account or both storage_endpoint and storage_account_access_key must be specified. examples: - - name: Enable an auditing policy by specifying storage account name - text: az db audit-policy update -g mygroup -s myserver -n mydb - --state Enabled --storage-account mystorage - - name: Enable an auditing policy by specifying storage account name and resource - group + - name: Enable by specifying storage account name text: az db audit-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-account mystorage - - name: Enable an auditing policy by specifying storage endpoint and key + - name: Enable by specifying storage endpoint and key text: az db audit-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net --storage-key MYKEY== @@ -110,10 +106,6 @@ - name: Enable by specifying storage account name text: az db threat-detection-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-account mystorage - - name: Enable by specifying storage account name and resource - group - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb - --state Enabled --storage-account mystorage - name: Enable by specifying storage endpoint and key text: az db threat-detection-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net From 411f26bd0af099b8ecc3032a2a1f20960770098e Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Fri, 17 Mar 2017 10:58:51 -0700 Subject: [PATCH 14/19] Made generic_update_command args explicit --- .../azure-cli-sql/azure/cli/command_modules/sql/_util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py index 3b00aeca6c7..34bfb5ae265 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_util.py @@ -92,7 +92,9 @@ def custom_command(self, name, custom_func_name): self._custom_path.format(custom_func_name), client_factory=self._client_factory) - def generic_update_command(self, name, getter_op, setter_op, custom_func_name=None, **kwargs): + # pylint: disable=too-many-arguments + def generic_update_command(self, name, getter_op, setter_op, custom_func_name=None, + setter_arg_name='parameters'): if custom_func_name: custom_function_op = self._custom_path.format(custom_func_name) else: @@ -105,7 +107,7 @@ def generic_update_command(self, name, getter_op, setter_op, custom_func_name=No self._service_adapter(setter_op), factory=self._client_factory, custom_function_op=custom_function_op, - **kwargs) + setter_arg_name=setter_arg_name) # PARAMETERS UTILITIES From 0fb8ef21c94db1783d1655907de98b03aaa0ed58 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Fri, 17 Mar 2017 11:01:18 -0700 Subject: [PATCH 15/19] threat-detection-policy -> threat-policy --- .../azure/cli/command_modules/sql/commands.py | 2 +- .../azure/cli/command_modules/sql/custom.py | 2 +- .../azure/cli/command_modules/sql/help.py | 14 +++++++------- .../azure/cli/command_modules/sql/params.py | 4 ++-- .../azure-cli-sql/tests/test_sql_commands.py | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py index 850ce5462d5..cc5851dd07b 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/commands.py @@ -84,7 +84,7 @@ with ServiceGroup(__name__, get_sql_database_threat_detection_policies_operations, database_threat_detection_policy_operations) as s: - with s.group('sql db threat-detection-policy') as c: + with s.group('sql db threat-policy') as c: c.command('show', 'get') c.generic_update_command('update', 'get', 'create_or_update', custom_func_name='db_threat_detection_policy_update', diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index 13f6d38d0c7..6124e443c64 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -339,7 +339,7 @@ def db_update( ##### -# sql server audit-policy & threat-detection-policy +# sql server audit-policy & threat-policy ##### diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index a50977e1c86..c471cc09e11 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -93,32 +93,32 @@ type: command short-summary: Creates a new database by restoring from a database backup. """ -helps['sql db threat-detection-policy'] = """ +helps['sql db threat-policy'] = """ type: group short-summary: Manage a database's threat detection policy. """ -helps['sql db threat-detection-policy update'] = """ +helps['sql db threat-policy update'] = """ type: command short-summary: Updates a database's threat detection policy. long-summary: If the policy is being enabled, storage_account or both storage_endpoint and storage_account_access_key must be specified. examples: - name: Enable by specifying storage account name - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + text: az db threat-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-account mystorage - name: Enable by specifying storage endpoint and key - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + text: az db threat-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net --storage-key MYKEY== - name: Disable a subset of alert types - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + text: az db threat-policy update -g mygroup -s myserver -n mydb --disabled-alerts Sql_Injection_Vulnerability Access_Anomaly - name: Configure email recipients - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + text: az db threat-policy update -g mygroup -s myserver -n mydb --email-addresses me@examlee.com you@example.com --email-account-admins Enabled - name: Disable - text: az db threat-detection-policy update -g mygroup -s myserver -n mydb + text: az db threat-policy update -g mygroup -s myserver -n mydb --state Disabled """ # helps['sql db restore-point'] = """ diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index c87066a9c45..f2aedb104a3 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -322,7 +322,7 @@ def _configure_db_create_params( ##### -# sql db audit-policy & threat-detection-policy +# sql db audit-policy & threat-policy ##### def _configure_security_policy_storage_params(cmd): @@ -364,7 +364,7 @@ def _configure_security_policy_storage_params(cmd): help='The number of days to retain audit logs.') -with ParametersContext(command='sql db threat-detection-policy update') as c: +with ParametersContext(command='sql db threat-policy update') as c: _configure_security_policy_storage_params(c) policy_arg_group = 'Policy' diff --git a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py index d5ae02a4199..0912e2dc8dc 100644 --- a/src/command_modules/azure-cli-sql/tests/test_sql_commands.py +++ b/src/command_modules/azure-cli-sql/tests/test_sql_commands.py @@ -481,7 +481,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_2, JMESPathCheck('auditActionsAndGroups', audit_actions_expected)]) # get threat detection policy - self.cmd('sql db threat-detection-policy show -g {} -s {} -n {}' + self.cmd('sql db threat-policy show -g {} -s {} -n {}' .format(resource_group, server, database_name), checks=[JMESPathCheck('resourceGroup', resource_group)]) @@ -492,7 +492,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_2, email_addresses_expected = 'test1@example.com;test2@example.com' email_account_admins = 'Enabled' - self.cmd('sql db threat-detection-policy update -g {} -s {} -n {}' + self.cmd('sql db threat-policy update -g {} -s {} -n {}' ' --state {} --storage-key {} --storage-endpoint {}' ' --retention-days {} --email-addresses {} --disabled-alerts {}' ' --email-account-admins {}' @@ -511,7 +511,7 @@ def test_sql_db_security_mgmt(self, resource_group, resource_group_2, # update threat policy - specify storage account and resource group. use secondary key key_2 = self._get_storage_key(storage_account_2, resource_group_2) - self.cmd('sql db threat-detection-policy update -g {} -s {} -n {} --storage-account {}' + self.cmd('sql db threat-policy update -g {} -s {} -n {} --storage-account {}' .format(resource_group, server, database_name, storage_account_2, resource_group_2), checks=[ From 85cdc83d429c077ae7093f88bd3163fe1c9632e4 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Mon, 20 Mar 2017 09:21:01 -0700 Subject: [PATCH 16/19] Commented on import name parameter --- .../azure-cli-sql/azure/cli/command_modules/sql/params.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py index 8b00e4864dd..4d88d90c0b1 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/params.py @@ -295,7 +295,11 @@ def _configure_db_create_params( c.argument('authentication_type', options_list=('--auth_type',), **enum_choice_list(AuthenticationType)) c.argument('storage_key_type', **enum_choice_list(StorageKeyType)) - c.argument('name', options_list=('--slkdjflksdjf',), arg_type=ignore_type) + + # The parameter name '--name' is used for 'database_name', so we need to give a different name + # for the import extension 'name' parameter to avoid conflicts. This parameter is actually not + # needed, but we still need to avoid this conflict. + c.argument('name', options_list=('--unused-extension-name',), arg_type=ignore_type) ##### From 1633bbe54f576d78f7bc30b169a56ce96dc97b1b Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Mon, 20 Mar 2017 18:13:47 -0700 Subject: [PATCH 17/19] Corrected examples --- .../azure/cli/command_modules/sql/help.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index 0f6641ee6bd..567a9577215 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -50,23 +50,23 @@ storage_account_access_key must be specified. examples: - name: Enable by specifying storage account name - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-account mystorage - name: Enable by specifying storage endpoint and key - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net --storage-key MYKEY== - name: Set the list of audit actions - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --actions FAILED_DATABASE_AUTHENTICATION_GROUP 'UPDATE on database::mydb by public' - name: Add an audit action - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --add auditActionsAndGroups FAILED_DATABASE_AUTHENTICATION_GROUP - name: Remove an audit action by list index - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --add auditActionsAndGroups 0 - name: Disable an auditing policy - text: az db audit-policy update -g mygroup -s myserver -n mydb + text: az sql db audit-policy update -g mygroup -s myserver -n mydb --state Disabled """ helps['sql db replica'] = """ @@ -108,21 +108,21 @@ storage_account_access_key must be specified. examples: - name: Enable by specifying storage account name - text: az db threat-policy update -g mygroup -s myserver -n mydb + text: az sql db threat-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-account mystorage - name: Enable by specifying storage endpoint and key - text: az db threat-policy update -g mygroup -s myserver -n mydb + text: az sql db threat-policy update -g mygroup -s myserver -n mydb --state Enabled --storage-endpoint https://mystorage.blob.core.windows.net --storage-key MYKEY== - name: Disable a subset of alert types - text: az db threat-policy update -g mygroup -s myserver -n mydb + text: az sql db threat-policy update -g mygroup -s myserver -n mydb --disabled-alerts Sql_Injection_Vulnerability Access_Anomaly - name: Configure email recipients - text: az db threat-policy update -g mygroup -s myserver -n mydb + text: az sql db threat-policy update -g mygroup -s myserver -n mydb --email-addresses me@examlee.com you@example.com --email-account-admins Enabled - name: Disable - text: az db threat-policy update -g mygroup -s myserver -n mydb + text: az sql db threat-policy update -g mygroup -s myserver -n mydb --state Disabled """ # helps['sql db restore-point'] = """ From 5cf8fa3cb7700cc8f711665786f5484eb19d19e4 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Tue, 21 Mar 2017 09:51:36 -0700 Subject: [PATCH 18/19] Error messages for classic storage and blobless storage --- .../azure/cli/command_modules/sql/custom.py | 35 ++- .../recordings/test_sql_db_security_mgmt.yaml | 260 +++++++++--------- 2 files changed, 152 insertions(+), 143 deletions(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py index 9a496d18a26..223fcdb2280 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/custom.py @@ -354,21 +354,26 @@ def db_update( # because if it was a command line parameter then the customer would need to specify storage # resource group just to update some unrelated property, which is annoying and makes no sense to # the customer. -def _find_storage_account(name): - resource_type = 'Microsoft.Storage/storageAccounts' +def _find_storage_account_resource_group(name): + storage_type = 'Microsoft.Storage/storageAccounts' + classic_storage_type = 'Microsoft.ClassicStorage/storageAccounts' + + query = "name eq '{}' and (resourceType eq '{}' or resourceType eq '{}')".format( + name, storage_type, classic_storage_type) client = get_mgmt_service_client(ResourceManagementClient) - resources = list(client.resources.list( - filter="name eq '{}' and resourceType eq '{}'" - .format(name, resource_type))) + resources = list(client.resources.list(filter=query)) if len(resources) == 0: - raise CLIError('No resource with name {} and type {} was found.' - .format(name, resource_type)) + raise CLIError("No storage account with name '{}' was found.".format(name)) if len(resources) > 1: - raise CLIError('Multiple resources with name {} and type {} were found.' - .format(name, resource_type)) + raise CLIError("Multiple storage accounts with name '{}' were found.".format(name)) + + if resources[0].type == classic_storage_type: + raise CLIError("The storage account with name '{}' is a classic storage account which is" + " not supported by this command. Use a non-classic storage account or" + " specify storage endpoint and key instead.".format(name)) # Split the uri and return just the resource group return resources[0].id.split('/')[4] @@ -392,7 +397,13 @@ def _get_storage_endpoint( account_name=storage_account) # Get endpoint - return account.primary_endpoints.blob # pylint: disable=no-member + # pylint: disable=no-member + endpoints = account.primary_endpoints + try: + return endpoints.blob + except AttributeError: + raise CLIError("The storage account with name '{}' (id '{}') has no blob endpoint. Use a" + " different storage account.".format(account.name, account.id)) # Gets storage account key by querying storage ARM API. @@ -429,7 +440,7 @@ def _db_security_policy_update( # pylint: disable=too-many-arguments if storage_endpoint is not None: instance.storage_endpoint = storage_endpoint if storage_account is not None: - storage_resource_group = _find_storage_account(storage_account) + storage_resource_group = _find_storage_account_resource_group(storage_account) instance.storage_endpoint = _get_storage_endpoint(storage_account, storage_resource_group) # Set storage access key @@ -447,7 +458,7 @@ def _db_security_policy_update( # pylint: disable=too-many-arguments # function, but at least we tried. if storage_account is None: storage_account = _get_storage_account_name(instance.storage_endpoint) - storage_resource_group = _find_storage_account(storage_account) + storage_resource_group = _find_storage_account_resource_group(storage_account) instance.storage_account_access_key = _get_storage_key( storage_account, diff --git a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml index 7ce35826ad5..de9a97cc959 100644 --- a/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml +++ b/src/command_modules/azure-cli-sql/tests/recordings/test_sql_db_security_mgmt.yaml @@ -20,11 +20,11 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:42:04 GMT'] + date: ['Tue, 21 Mar 2017 16:40:40 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: body: '{"location": "westus", "tags": {"use": "az-test"}}' @@ -47,11 +47,11 @@ interactions: cache-control: [no-cache] content-length: ['326'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:42:06 GMT'] + date: ['Tue, 21 Mar 2017 16:40:43 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: body: '{"location": "westus", "properties": {"administratorLoginPassword": "SecretPassword123", @@ -76,15 +76,15 @@ interactions: content-length: ['695'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:42:32 GMT'] + date: ['Tue, 21 Mar 2017 16:41:15 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1193'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: - body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}' + body: '{"location": "westus", "sku": {"name": "Standard_LRS"}, "kind": "Storage"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -102,14 +102,14 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Fri, 17 Mar 2017 00:42:38 GMT'] + date: ['Tue, 21 Mar 2017 16:41:24 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/d140f0c3-f2f2-4503-a424-0d358a2d6f87?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/b9d4dc53-2d24-4187-b1a5-263fb04766c2?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} - request: body: null @@ -123,76 +123,76 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/d140f0c3-f2f2-4503-a424-0d358a2d6f87?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/b9d4dc53-2d24-4187-b1a5-263fb04766c2?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-17T00:42:34.6000701Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} - - '} + body: {string: ''} headers: cache-control: [no-cache] - content-length: ['827'] - content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:42:56 GMT'] + content-length: ['0'] + date: ['Tue, 21 Mar 2017 16:41:42 GMT'] expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/b9d4dc53-2d24-4187-b1a5-263fb04766c2?monitor=true&api-version=2016-12-01'] pragma: [no-cache] + retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - status: {code: 200, message: OK} + status: {code: 202, message: Accepted} - request: - body: '{"sku": {"name": "Standard_LRS"}, "location": "westus", "kind": "Storage"}' + body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [storage account create] Connection: [keep-alive] - Content-Length: ['74'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/b9d4dc53-2d24-4187-b1a5-263fb04766c2?monitor=true&api-version=2016-12-01 response: - body: {string: ''} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-21T16:41:17.6105411Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + + '} headers: cache-control: [no-cache] - content-length: ['0'] - date: ['Fri, 17 Mar 2017 00:43:03 GMT'] + content-length: ['827'] + content-type: [application/json] + date: ['Tue, 21 Mar 2017 16:41:59 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01'] pragma: [no-cache] - retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - status: {code: 202, message: Accepted} + transfer-encoding: [chunked] + vary: [Accept-Encoding] + status: {code: 200, message: OK} - request: - body: null + body: '{"location": "westus", "sku": {"name": "Standard_LRS"}, "kind": "Storage"}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [storage account create] Connection: [keep-alive] + Content-Length: ['74'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01 + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: body: {string: ''} headers: cache-control: [no-cache] content-length: ['0'] - date: ['Fri, 17 Mar 2017 00:43:22 GMT'] + date: ['Tue, 21 Mar 2017 16:42:02 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/4c4a814e-67e0-49c3-bbed-d9f6727617df?monitor=true&api-version=2016-12-01'] pragma: [no-cache] retry-after: ['17'] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 202, message: Accepted} - request: body: null @@ -206,16 +206,16 @@ interactions: msrest_azure/0.4.7 storagemanagementclient/0.31.0 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/2992b378-1b0b-436c-8dc6-310b0a2fd0f7?monitor=true&api-version=2016-12-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/operations/4c4a814e-67e0-49c3-bbed-d9f6727617df?monitor=true&api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-21T16:42:01.7892993Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:43:40 GMT'] + date: ['Tue, 21 Mar 2017 16:42:20 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -237,14 +237,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-17T00:42:34.6000701Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004","kind":"Storage","location":"westus","name":"clitest000004","properties":{"creationTime":"2017-03-21T16:41:17.6105411Z","primaryEndpoints":{"blob":"https://clitest000004.blob.core.windows.net/","file":"https://clitest000004.file.core.windows.net/","queue":"https://clitest000004.queue.core.windows.net/","table":"https://clitest000004.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:43:41 GMT'] + date: ['Tue, 21 Mar 2017 16:42:22 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -267,14 +267,14 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000004/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw=="},{"keyName":"key2","permissions":"Full","value":"qUwBXMfDYdtLd1eoTQzS0rRxThbB2YzrdyJW+Vm1ZmeGEIw+4ZtH15+HHuTsjy0eFDneCI4vQZSAEN0Ehog2mA=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"XWb0CfQ1vjVmN2+aU/b1eiKBO1FzJhxkTv2mbp5Ryvucdgv733I+pVm8DeNxt+pxUnN+RrRga97uVCe1xIzc9A=="},{"keyName":"key2","permissions":"Full","value":"umNsm4VVyfShpkaQu685eHJLShyRFN4sDG+x2xSkecrFoN6hZE83tvSr1zAJyJ9R1p69FI5LLl1CZHmRaKAjVQ=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:43:44 GMT'] + date: ['Tue, 21 Mar 2017 16:42:24 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -304,7 +304,7 @@ interactions: content-length: ['680'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:43:46 GMT'] + date: ['Tue, 21 Mar 2017 16:42:25 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -326,21 +326,21 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: - body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1489711430032+0000)\/"}'} + body: {string: '{"operation":"CreateLogicalDatabase","startTime":"\/Date(1490114549119+0000)\/"}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/ad716bef-686e-437e-babc-b3f5290ed146?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['80'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:43:47 GMT'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/operationResults/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] + date: ['Tue, 21 Mar 2017 16:42:26 GMT'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/operationResults/ad716bef-686e-437e-babc-b3f5290ed146?api-version=2014-04-01-Preview'] preference-applied: [return-content] retry-after: ['30'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 202, message: Accepted} - request: body: null @@ -354,16 +354,16 @@ interactions: msrest_azure/0.4.7 sqlmanagementclient/0.3.3 Azure-SDK-For-Python AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/ad716bef-686e-437e-babc-b3f5290ed146?api-version=2014-04-01-Preview response: - body: {string: '{"operationId":"6e2cc577-266a-4bea-b623-9a9f40f660e9","status":"Succeeded","error":null}'} + body: {string: '{"operationId":"ad716bef-686e-437e-babc-b3f5290ed146","status":"Succeeded","error":null}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/6e2cc577-266a-4bea-b623-9a9f40f660e9?api-version=2014-04-01-Preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/azureAsyncOperation/ad716bef-686e-437e-babc-b3f5290ed146?api-version=2014-04-01-Preview'] cache-control: ['no-store, no-cache'] content-length: ['88'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:17 GMT'] + date: ['Tue, 21 Mar 2017 16:42:57 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -385,14 +385,14 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01?api-version=2014-04-01 response: body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01","name":"cliautomationdb01","type":"Microsoft.Sql/servers/databases","location":"West - US","kind":"v12.0,user","properties":{"databaseId":"1912e921-0ad8-4a85-8acf-6384b8069293","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-17T00:43:50.223Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East - US","earliestRestoreDate":"2017-03-17T00:54:19.697Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} + US","kind":"v12.0,user","properties":{"databaseId":"c8fe5acb-3081-429b-bf08-f73ee4b9bca4","edition":"Standard","status":"Online","serviceLevelObjective":"S0","collation":"SQL_Latin1_General_CP1_CI_AS","maxSizeBytes":"268435456000","creationDate":"2017-03-21T16:42:29.323Z","currentServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveId":"f1173c43-91bd-4aaa-973c-54e79e15235b","requestedServiceObjectiveName":"S0","sampleName":null,"defaultSecondaryLocation":"East + US","earliestRestoreDate":"2017-03-21T16:52:52.967Z","elasticPoolName":null,"containmentState":2,"readScale":"Disabled","failoverGroupId":null}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['1000'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:19 GMT'] + date: ['Tue, 21 Mar 2017 16:42:58 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -418,7 +418,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:20 GMT'] + date: ['Tue, 21 Mar 2017 16:42:59 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -445,7 +445,7 @@ interactions: cache-control: [no-cache] content-length: ['618'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:21 GMT'] + date: ['Tue, 21 Mar 2017 16:43:01 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -454,10 +454,10 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": - "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Enabled", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], - "storageAccountAccessKey": "7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==", + body: 'b''{"properties": {"retentionDays": 30, "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], "state": "Enabled", "isStorageSecondaryKeyInUse": + false, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageAccountAccessKey": "XWb0CfQ1vjVmN2+aU/b1eiKBO1FzJhxkTv2mbp5Ryvucdgv733I+pVm8DeNxt+pxUnN+RrRga97uVCe1xIzc9A==", "storageEndpoint": "https://clitest000004.blob.core.windows.net/"}}''' headers: Accept: [application/json] @@ -477,7 +477,7 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:24 GMT'] + date: ['Tue, 21 Mar 2017 16:43:03 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -498,14 +498,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-21T16:42:01.7892993Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:26 GMT'] + date: ['Tue, 21 Mar 2017 16:43:05 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -532,7 +532,7 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:28 GMT'] + date: ['Tue, 21 Mar 2017 16:43:06 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -553,14 +553,14 @@ interactions: AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=name%20eq%20%27clitest000005%27%20and%20resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27&api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?api-version=2016-09-01&$filter=name%20eq%20%27clitest000005%27%20and%20%28resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27%20or%20resourceType%20eq%20%27Microsoft.ClassicStorage%2FstorageAccounts%27%29 response: body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","name":"clitest000005","type":"Microsoft.Storage/storageAccounts","sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","location":"westus","tags":{}}]}'} headers: cache-control: [no-cache] content-length: ['403'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:28 GMT'] + date: ['Tue, 21 Mar 2017 16:43:06 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -580,14 +580,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-21T16:42:01.7892993Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:29 GMT'] + date: ['Tue, 21 Mar 2017 16:43:07 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -610,27 +610,27 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w=="},{"keyName":"key2","permissions":"Full","value":"l2caComTwlC/ZaIpKTSgxxz7lrsOxIZw9+YqKZiLI/I8zrs8Rca8i66fzXsjnScE7ylCHv0iD4/Yp/jFyGfDYA=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:29 GMT'] + date: ['Tue, 21 Mar 2017 16:43:07 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1192'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": - "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Enabled", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], - "storageAccountAccessKey": "8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==", + body: 'b''{"properties": {"retentionDays": 30, "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], "state": "Enabled", "isStorageSecondaryKeyInUse": + false, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", + "storageAccountAccessKey": "/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w==", "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] @@ -650,14 +650,14 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:34 GMT'] + date: ['Tue, 21 Mar 2017 16:43:08 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -678,7 +678,7 @@ interactions: cache-control: [no-cache] content-length: ['732'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:36 GMT'] + date: ['Tue, 21 Mar 2017 16:43:10 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -687,9 +687,9 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": - "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Disabled", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + body: 'b''{"properties": {"retentionDays": 30, "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], "state": "Disabled", "isStorageSecondaryKeyInUse": + false, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", "storageAccountAccessKey": "", "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] @@ -709,7 +709,7 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:38 GMT'] + date: ['Tue, 21 Mar 2017 16:43:10 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -723,7 +723,7 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy show] + CommandName: [sql db threat-policy show] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 @@ -739,7 +739,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:39 GMT'] + date: ['Tue, 21 Mar 2017 16:43:12 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -751,7 +751,7 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 @@ -767,7 +767,7 @@ interactions: content-length: ['621'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:41 GMT'] + date: ['Tue, 21 Mar 2017 16:43:14 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -775,15 +775,14 @@ interactions: x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"storageAccountAccessKey": "7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==", - "retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", - "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", - "emailAccountAdmins": "Enabled", "storageEndpoint": "https://clitest000004.blob.core.windows.net/", - "useServerDefault": "Enabled"}}''' + body: 'b''{"properties": {"retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", + "state": "Enabled", "emailAccountAdmins": "Enabled", "useServerDefault": "Enabled", + "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", "storageEndpoint": + "https://clitest000004.blob.core.windows.net/", "storageAccountAccessKey": "XWb0CfQ1vjVmN2+aU/b1eiKBO1FzJhxkTv2mbp5Ryvucdgv733I+pVm8DeNxt+pxUnN+RrRga97uVCe1xIzc9A=="}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Length: ['439'] Content-Type: [application/json; charset=utf-8] @@ -793,20 +792,20 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"7QdJg2ya0MoXXVcrVc6jgSkkNMunnqeTJ3tBe7y0fWEE9Y2pRa3ij8VKm5gS+Uey2sFjyXw0j2jQlSElu0fGVw==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Enabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000004.blob.core.windows.net/","storageAccountAccessKey":"XWb0CfQ1vjVmN2+aU/b1eiKBO1FzJhxkTv2mbp5Ryvucdgv733I+pVm8DeNxt+pxUnN+RrRga97uVCe1xIzc9A==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['834'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:45 GMT'] + date: ['Tue, 21 Mar 2017 16:43:16 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1194'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -823,28 +822,28 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w=="},{"keyName":"key2","permissions":"Full","value":"l2caComTwlC/ZaIpKTSgxxz7lrsOxIZw9+YqKZiLI/I8zrs8Rca8i66fzXsjnScE7ylCHv0iD4/Yp/jFyGfDYA=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:46 GMT'] + date: ['Tue, 21 Mar 2017 16:43:17 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 @@ -860,7 +859,7 @@ interactions: content-length: ['752'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:47 GMT'] + date: ['Tue, 21 Mar 2017 16:43:18 GMT'] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] @@ -872,7 +871,7 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 @@ -880,14 +879,14 @@ interactions: AZURECLI/2.0.1+dev] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=name%20eq%20%27clitest000005%27%20and%20resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27&api-version=2016-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?api-version=2016-09-01&$filter=name%20eq%20%27clitest000005%27%20and%20%28resourceType%20eq%20%27Microsoft.Storage%2FstorageAccounts%27%20or%20resourceType%20eq%20%27Microsoft.ClassicStorage%2FstorageAccounts%27%29 response: body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","name":"clitest000005","type":"Microsoft.Storage/storageAccounts","sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","location":"westus","tags":{}}]}'} headers: cache-control: [no-cache] content-length: ['403'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:48 GMT'] + date: ['Tue, 21 Mar 2017 16:43:19 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -898,7 +897,7 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5 @@ -907,14 +906,14 @@ interactions: method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005?api-version=2016-12-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-17T00:42:59.9214846Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005","kind":"Storage","location":"westus","name":"clitest000005","properties":{"creationTime":"2017-03-21T16:42:01.7892993Z","primaryEndpoints":{"blob":"https://clitest000005.blob.core.windows.net/","file":"https://clitest000005.file.core.windows.net/","queue":"https://clitest000005.queue.core.windows.net/","table":"https://clitest000005.table.core.windows.net/"},"primaryLocation":"westus","provisioningState":"Succeeded","statusOfPrimary":"available"},"sku":{"name":"Standard_LRS","tier":"Standard"},"tags":{},"type":"Microsoft.Storage/storageAccounts"} '} headers: cache-control: [no-cache] content-length: ['827'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:48 GMT'] + date: ['Tue, 21 Mar 2017 16:43:19 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] @@ -927,7 +926,7 @@ interactions: headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] @@ -937,32 +936,31 @@ interactions: method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000002/providers/Microsoft.Storage/storageAccounts/clitest000005/listKeys?api-version=2016-12-01 response: - body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw=="},{"keyName":"key2","permissions":"Full","value":"aEen69r4nkA697f8m7Y2Pxc25XTcUFYdh0GedSTuLmGjGKpiENMtV/g0fWmwY8CQC2VaCZ/oVDsk8dssn+qjUw=="}]} + body: {string: '{"keys":[{"keyName":"key1","permissions":"Full","value":"/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w=="},{"keyName":"key2","permissions":"Full","value":"l2caComTwlC/ZaIpKTSgxxz7lrsOxIZw9+YqKZiLI/I8zrs8Rca8i66fzXsjnScE7ylCHv0iD4/Yp/jFyGfDYA=="}]} '} headers: cache-control: [no-cache] content-length: ['289'] content-type: [application/json] - date: ['Fri, 17 Mar 2017 00:44:49 GMT'] + date: ['Tue, 21 Mar 2017 16:43:20 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1193'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"storageAccountAccessKey": "8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==", - "retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", - "state": "Enabled", "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", - "emailAccountAdmins": "Enabled", "storageEndpoint": "https://clitest000005.blob.core.windows.net/", - "useServerDefault": "Disabled"}}''' + body: 'b''{"properties": {"retentionDays": 30, "emailAddresses": "test1@example.com;test2@example.com", + "state": "Enabled", "emailAccountAdmins": "Enabled", "useServerDefault": "Disabled", + "disabledAlerts": "Sql_Injection_Vulnerability;Access_Anomaly", "storageEndpoint": + "https://clitest000005.blob.core.windows.net/", "storageAccountAccessKey": "/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w=="}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] - CommandName: [sql db threat-detection-policy update] + CommandName: [sql db threat-policy update] Connection: [keep-alive] Content-Length: ['440'] Content-Type: [application/json; charset=utf-8] @@ -972,20 +970,20 @@ interactions: method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default?api-version=2014-04-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"8U8ReaFM4Ga4hfkJ5ddRov+zYZzaYAaoBCQq1vq6SBt0QHboTXwgIJ5xNp/e7T5Nek1aYM4ZCefdAZtQTiZJUw==","retentionDays":30}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Sql/servers/clitestserver000003/databases/cliautomationdb01/securityAlertPolicies/default","name":"default","type":"Microsoft.Sql/servers/databases/securityAlertPolicies","location":null,"kind":null,"properties":{"useServerDefault":"Disabled","state":"Enabled","disabledAlerts":"Sql_Injection_Vulnerability;Access_Anomaly","emailAddresses":"test1@example.com;test2@example.com","emailAccountAdmins":"Enabled","storageEndpoint":"https://clitest000005.blob.core.windows.net/","storageAccountAccessKey":"/SbYO3wOwqIArNfnJgDxmn4OYSg6UjlaWlw+xQ3/urEwyw/V70oAgeJ+nC4wZ1SmiVmtAOIka6iojA/z1VPl4w==","retentionDays":30}}'} headers: cache-control: ['no-store, no-cache'] content-length: ['835'] content-type: [application/json; odata=minimalmetadata; streaming=true; charset=utf-8] dataserviceversion: [3.0;] - date: ['Fri, 17 Mar 2017 00:44:53 GMT'] + date: ['Tue, 21 Mar 2017 16:43:21 GMT'] preference-applied: [return-content] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 200, message: OK} - request: body: null @@ -1006,7 +1004,7 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:56 GMT'] + date: ['Tue, 21 Mar 2017 16:43:22 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] @@ -1015,9 +1013,9 @@ interactions: vary: [Accept-Encoding] status: {code: 200, message: OK} - request: - body: 'b''{"properties": {"isStorageSecondaryKeyInUse": false, "storageAccountSubscriptionId": - "00000000-0000-0000-0000-000000000000", "retentionDays": 30, "state": "Disabled", - "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], + body: 'b''{"properties": {"retentionDays": 30, "auditActionsAndGroups": ["DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP"], "state": "Disabled", "isStorageSecondaryKeyInUse": + false, "storageAccountSubscriptionId": "00000000-0000-0000-0000-000000000000", "storageAccountAccessKey": "", "storageEndpoint": "https://clitest000005.blob.core.windows.net/"}}''' headers: Accept: [application/json] @@ -1037,14 +1035,14 @@ interactions: cache-control: [no-cache] content-length: ['733'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Mar 2017 00:44:58 GMT'] + date: ['Tue, 21 Mar 2017 16:43:22 GMT'] expires: ['-1'] pragma: [no-cache] server: [Microsoft-HTTPAPI/2.0] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] status: {code: 200, message: OK} - request: body: null @@ -1066,9 +1064,9 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Fri, 17 Mar 2017 00:45:02 GMT'] + date: ['Tue, 21 Mar 2017 16:43:24 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdFMTQxMEZFRjU2QkFDMjhBNEEyQkY0QzlFRjQ4QTQ1ODYyNHwwNDIyRTZCNjg0OTE4OTVDLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkcwRjQ3MjQwQ0MxREZBRTM5NzQxQ0I5M0I5QURBNDBDOTk0Q3wyNUI2RDQ5MERCRDUzRTg0LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -1094,9 +1092,9 @@ interactions: headers: cache-control: [no-cache] content-length: ['0'] - date: ['Fri, 17 Mar 2017 00:45:03 GMT'] + date: ['Tue, 21 Mar 2017 16:43:26 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkcxN0Q0Q0RBNkM1MEU5QTRFRkNDNUY3NkJEODRDQUIwNkNCMHxGRTdDQkJFQTk3NjNBQkQ4LVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdGNkEzM0JGQjg5Qzg3NEQ4QkQzMEQ3ODIxMDFDRTJDMzFCN3w4MDY1RTYyNzkyQjMwRTdGLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2016-09-01'] pragma: [no-cache] retry-after: ['15'] strict-transport-security: [max-age=31536000; includeSubDomains] From 055210f66e63b8a6d02a81ea4894f3af4a69a139 Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Tue, 21 Mar 2017 10:02:48 -0700 Subject: [PATCH 19/19] Fixed example --- .../azure-cli-sql/azure/cli/command_modules/sql/help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py index 567a9577215..85496be5b32 100644 --- a/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py +++ b/src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/help.py @@ -64,7 +64,7 @@ --add auditActionsAndGroups FAILED_DATABASE_AUTHENTICATION_GROUP - name: Remove an audit action by list index text: az sql db audit-policy update -g mygroup -s myserver -n mydb - --add auditActionsAndGroups 0 + --remove auditActionsAndGroups 0 - name: Disable an auditing policy text: az sql db audit-policy update -g mygroup -s myserver -n mydb --state Disabled