diff --git a/src/azure-cli/azure/cli/command_modules/backup/_params.py b/src/azure-cli/azure/cli/command_modules/backup/_params.py index 3cd669b5f41..a2669ea261c 100644 --- a/src/azure-cli/azure/cli/command_modules/backup/_params.py +++ b/src/azure-cli/azure/cli/command_modules/backup/_params.py @@ -36,7 +36,7 @@ target_server_type_help = """Specify the type of the server which should be discovered.""" protectable_item_name_type_help = """Specify the resource name to be protected by Azure Backup service.""" backup_type_help = """'Full, Differential, Log, Copy-only-full' for backup Item type 'MSSQL'. 'Full, Differential' for backup item type 'SAPHANA'.""" -retain_until_help = """The date until which this backed up copy will be available for retrieval, in UTC (d-m-Y). For SAPHANA and SQL workload, retain-until parameter value will be overridden by the underlying policy.""" +retain_until_help = """The date until which this backed up copy will be available for retrieval, in UTC (d-m-Y). If not specified, 30 days will be taken as default value. For SAPHANA and SQL workload, retain-until parameter value will be overridden by the underlying policy.""" diskslist_help = """List of disks to be excluded or included.""" disk_list_setting_help = """option to decide whether to include or exclude the disk or reset any previous settings to default behavior""" target_container_name_help = """The target container to which the DB recovery point should be downloaded as files.""" diff --git a/src/azure-cli/azure/cli/command_modules/backup/custom.py b/src/azure-cli/azure/cli/command_modules/backup/custom.py index 7a17eee7502..2391776d09d 100644 --- a/src/azure-cli/azure/cli/command_modules/backup/custom.py +++ b/src/azure-cli/azure/cli/command_modules/backup/custom.py @@ -376,6 +376,8 @@ def update_policy_for_item(cmd, client, resource_group_name, vault_name, item, p def backup_now(cmd, client, resource_group_name, vault_name, item, retain_until): + if retain_until is None: + retain_until = (datetime.utcnow() + timedelta(days=30)).strftime('%d-%m-%Y') # Get container and item URIs container_uri = _get_protection_container_uri_from_id(item.id) item_uri = _get_protected_item_uri_from_id(item.id) diff --git a/src/azure-cli/azure/cli/command_modules/backup/custom_afs.py b/src/azure-cli/azure/cli/command_modules/backup/custom_afs.py index af92c7dcaae..0274fe33ca3 100644 --- a/src/azure-cli/azure/cli/command_modules/backup/custom_afs.py +++ b/src/azure-cli/azure/cli/command_modules/backup/custom_afs.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - +from datetime import datetime, timedelta import azure.cli.command_modules.backup.custom_help as helper # pylint: disable=import-error # pylint: disable=unused-argument @@ -85,6 +85,8 @@ def enable_for_AzureFileShare(cmd, client, resource_group_name, vault_name, afs_ def backup_now(cmd, client, resource_group_name, vault_name, item, retain_until): + if retain_until is None: + retain_until = (datetime.utcnow() + timedelta(days=30)).strftime('%d-%m-%Y') container_uri = helper.get_protection_container_uri_from_id(item.id) item_uri = helper.get_protected_item_uri_from_id(item.id) trigger_backup_request = _get_backup_request(retain_until)