diff --git a/src/azure-cli/HISTORY.rst b/src/azure-cli/HISTORY.rst index ae1dfb36812..766acedea56 100644 --- a/src/azure-cli/HISTORY.rst +++ b/src/azure-cli/HISTORY.rst @@ -37,6 +37,7 @@ Release History * `az storage account create`: Remove preview flag for --enable-hierarchical-namespace parameter * Update azure-mgmt-storage version to 7.0.0 to use api version 2019-06-01 +* Add new parameters `--enable-delete-retention` and `--delete-retention-days` to support managing delete retention policy for storage account blob-service-properties. 2.0.78 ++++++ diff --git a/src/azure-cli/azure/cli/command_modules/storage/_help.py b/src/azure-cli/azure/cli/command_modules/storage/_help.py index cd67ee6ca01..0951ea00ce4 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_help.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_help.py @@ -40,13 +40,19 @@ long-summary: > Update the properties of a storage account's blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules. But currently we only support enabling or disabling change feed for a storage account's blob service. + Sharing) rules. parameters: - name: --enable-change-feed short-summary: 'Indicate whether change feed event logging is enabled. If it is true, you enable the storage account to begin capturing changes. The default value is true. You can see more details in https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed?tabs=azure-portal#register-by-using-azure-cli' + - name: --enable-delete-retention + short-summary: 'Indicate whether delete retention policy is enabled for the blob service.' + - name: --delete-retention-days + short-summary: 'Indicate the number of days that the deleted blob should be retained. The value must be in range [1,365]. It must be provided when `--enable-delete-retention` is true.' examples: - name: Enable the change feed for the storage account 'MyStorageAccount' in resource group 'MyResourceGroup'. text: az storage account blob-service-properties update --enable-change-feed true -n MyStorageAccount -g MyResourceGroup + - name: Enable delete retention policy and set delete retention days to 100 for the storage account 'MyStorageAccount' in resource group 'MyResourceGroup'. + text: az storage account blob-service-properties update --enable-delete-retention true --delete-retention-days 100 -n MyStorageAccount -g MyResourceGroup """ helps['storage account create'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/storage/_params.py b/src/azure-cli/azure/cli/command_modules/storage/_params.py index 671c3104702..9b4dc0d88ea 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_params.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_params.py @@ -247,9 +247,14 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem with self.argument_context('storage account blob-service-properties update', resource_type=ResourceType.MGMT_STORAGE) as c: + from ._validators import validator_delete_retention_days c.argument('account_name', acct_name_type, id_part=None) c.argument('resource_group_name', required=False, validator=process_resource_group) c.argument('enable_change_feed', arg_type=get_three_state_flag(), min_api='2019-04-01') + c.argument('enable_delete_retention', arg_type=get_three_state_flag(), arg_group='Delete Retention Policy', + min_api='2018-07-01') + c.argument('delete_retention_days', type=int, arg_group='Delete Retention Policy', + validator=validator_delete_retention_days, min_api='2018-07-01') with self.argument_context('storage account generate-sas') as c: t_account_permissions = self.get_sdk('common.models#AccountPermissions') diff --git a/src/azure-cli/azure/cli/command_modules/storage/_validators.py b/src/azure-cli/azure/cli/command_modules/storage/_validators.py index e55a50661a0..4bc1142e630 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_validators.py @@ -1121,3 +1121,27 @@ def as_user_validator(namespace): import argparse raise argparse.ArgumentError( None, "incorrect usage: specify '--auth-mode login' when as-user is enabled") + + +def validator_delete_retention_days(namespace): + if namespace.enable_delete_retention is True and namespace.delete_retention_days is None: + raise ValueError( + "incorrect usage: you have to provide value for '--delete-retention-days' when '--enable-delete-retention' " + "is set to true") + + if namespace.enable_delete_retention is False and namespace.delete_retention_days is not None: + raise ValueError( + "incorrect usage: '--delete-retention-days' is invalid when '--enable-delete-retention' is set to false") + + if namespace.enable_delete_retention is None and namespace.delete_retention_days is not None: + raise ValueError( + "incorrect usage: please specify '--enable-delete-retention true' if you want to set the value for " + "'--delete-retention-days'") + + if namespace.delete_retention_days or namespace.delete_retention_days == 0: + if namespace.delete_retention_days < 1: + raise ValueError( + "incorrect usage: '--delete-retention-days' must be greater than or equal to 1") + if namespace.delete_retention_days > 365: + raise ValueError( + "incorrect usage: '--delete-retention-days' must be less than or equal to 365") diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/account.py b/src/azure-cli/azure/cli/command_modules/storage/operations/account.py index eeabd16cbb5..b216342bd89 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/operations/account.py +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/account.py @@ -337,8 +337,16 @@ def update_management_policies(client, resource_group_name, account_name, parame return client.create_or_update(resource_group_name, account_name, policy=parameters) -# TODO: support updating other properties besides 'enable_change_feed' -def update_blob_service_properties(cmd, instance, enable_change_feed=None): +# TODO: support updating other properties besides 'enable_change_feed,delete_retention_policy' +def update_blob_service_properties(cmd, instance, enable_change_feed=None, enable_delete_retention=None, + delete_retention_days=None): if enable_change_feed is not None: instance.change_feed = cmd.get_models('ChangeFeed')(enabled=enable_change_feed) + + if enable_delete_retention is not None: + if enable_delete_retention is False: + delete_retention_days = None + instance.delete_retention_policy = cmd.get_models('DeleteRetentionPolicy')( + enabled=enable_delete_retention, days=delete_retention_days) + return instance diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_account_update_delete_retention_policy.yaml b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_account_update_delete_retention_policy.yaml new file mode 100644 index 00000000000..283ba747e53 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_account_update_delete_retention_policy.yaml @@ -0,0 +1,422 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"sku":{"name":"Standard_LRS"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":false}}}' + headers: + cache-control: + - no-cache + content-length: + - '425' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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: '{"properties": {"cors": {"corsRules": []}, "deleteRetentionPolicy": {"enabled": + true, "days": 1}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + Content-Length: + - '98' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":1}}}' + headers: + cache-control: + - no-cache + content-length: + - '403' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"sku":{"name":"Standard_LRS"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":1}}}' + headers: + cache-control: + - no-cache + content-length: + - '433' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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: '{"properties": {"cors": {"corsRules": []}, "deleteRetentionPolicy": {"enabled": + true, "days": 100}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + Content-Length: + - '100' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":100}}}' + headers: + cache-control: + - no-cache + content-length: + - '405' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"sku":{"name":"Standard_LRS"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":100}}}' + headers: + cache-control: + - no-cache + content-length: + - '435' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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: '{"properties": {"cors": {"corsRules": []}, "deleteRetentionPolicy": {"enabled": + true, "days": 365}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + Content-Length: + - '100' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --enable-delete-retention --delete-retention-days -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":365}}}' + headers: + cache-control: + - no-cache + content-length: + - '405' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + ParameterSetName: + - --enable-delete-retention -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"sku":{"name":"Standard_LRS"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":true,"days":365}}}' + headers: + cache-control: + - no-cache + content-length: + - '435' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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: '{"properties": {"cors": {"corsRules": []}, "deleteRetentionPolicy": {"enabled": + false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account blob-service-properties update + Connection: + - keep-alive + Content-Length: + - '88' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --enable-delete-retention -n -g + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-storage/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.78 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default?api-version=2019-06-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_storage_account_update_delete_retention_policy000001/providers/Microsoft.Storage/storageAccounts/clitest000002/blobServices/default","name":"default","type":"Microsoft.Storage/storageAccounts/blobServices","properties":{"cors":{"corsRules":[]},"deleteRetentionPolicy":{"enabled":false}}}' + headers: + cache-control: + - no-cache + content-length: + - '395' + content-type: + - application/json + date: + - Tue, 31 Dec 2019 02:27:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 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: + - '1189' + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_account_scenarios.py b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_account_scenarios.py index ebb11bbc8d5..08c4307a4ec 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_account_scenarios.py +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_account_scenarios.py @@ -643,3 +643,46 @@ def test_storage_account_update_change_feed(self): result = self.cmd('storage account blob-service-properties show -n {sa} -g {rg}').get_output_in_json() self.assertEqual(result['changeFeed']['enabled'], True) + + @ResourceGroupPreparer(name_prefix='cli_storage_account_update_delete_retention_policy') + @StorageAccountPreparer() + def test_storage_account_update_delete_retention_policy(self, resource_group, storage_account): + self.kwargs.update({ + 'sa': storage_account, + 'rg': resource_group, + 'cmd': 'storage account blob-service-properties update' + }) + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --enable-delete-retention true -n {sa} -g {rg}') + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --enable-delete-retention false --delete-retention-days 365 -n {sa} -g {rg}').get_output_in_json() + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --delete-retention-days 1 -n {sa} -g {rg}').get_output_in_json() + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --enable-delete-retention true --delete-retention-days -1 -n {sa} -g {rg}') + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --enable-delete-retention true --delete-retention-days 0 -n {sa} -g {rg}') + + with self.assertRaises(SystemExit): + self.cmd('{cmd} --enable-delete-retention true --delete-retention-days 366 -n {sa} -g {rg}') + + result = self.cmd('{cmd} --enable-delete-retention true --delete-retention-days 1 -n {sa} -g {rg}').get_output_in_json() + self.assertEqual(result['deleteRetentionPolicy']['enabled'], True) + self.assertEqual(result['deleteRetentionPolicy']['days'], 1) + + result = self.cmd('{cmd} --enable-delete-retention true --delete-retention-days 100 -n {sa} -g {rg}').get_output_in_json() + self.assertEqual(result['deleteRetentionPolicy']['enabled'], True) + self.assertEqual(result['deleteRetentionPolicy']['days'], 100) + + result = self.cmd('{cmd} --enable-delete-retention true --delete-retention-days 365 -n {sa} -g {rg}').get_output_in_json() + self.assertEqual(result['deleteRetentionPolicy']['enabled'], True) + self.assertEqual(result['deleteRetentionPolicy']['days'], 365) + + result = self.cmd('{cmd} --enable-delete-retention false -n {sa} -g {rg}').get_output_in_json() + self.assertEqual(result['deleteRetentionPolicy']['enabled'], False) + self.assertEqual(result['deleteRetentionPolicy']['days'], None)