Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from datetime import datetime, timezone, timedelta
import azure.cli.command_modules.backup.custom as custom
import azure.cli.command_modules.backup.custom_afs as custom_afs
import azure.cli.command_modules.backup.custom_help as custom_help
Expand Down Expand Up @@ -100,6 +101,9 @@ def backup_now(cmd, client, resource_group_name, vault_name, item_name, retain_u
if isinstance(item, list):
raise ValidationError("Multiple items found. Please give native names instead.")

if retain_until is None:
retain_until = datetime.now(timezone.utc) + timedelta(days=30)

if item.properties.backup_management_type.lower() == "azureiaasvm":
return custom.backup_now(cmd, client, resource_group_name, vault_name, item, retain_until)

Expand Down