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
10 changes: 7 additions & 3 deletions src/azure-cli/azure/cli/command_modules/backup/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ def enable_protection_for_vm(cmd, client, resource_group_name, vault_name, vm, p
vault = vaults_cf(cmd.cli_ctx).get(resource_group_name, vault_name)
policy = show_policy(protection_policies_cf(cmd.cli_ctx), resource_group_name, vault_name, policy_name)

# throw error if policy has more than 1000 protected VMs.
if policy.properties.protected_items_count >= 1000:
raise CLIError("Cannot configure backup for more than 1000 VMs per policy")

if vm.location.lower() != vault.location.lower():
raise CLIError(
"""
Expand Down Expand Up @@ -344,9 +348,9 @@ def update_policy_for_item(cmd, client, resource_group_name, vault_name, item, p
Use the relevant get-default policy command and use it to update the policy for the workload.
""")

# throw error if policy has more than 100 protected VMs.
if policy.properties.protected_items_count >= 100:
raise CLIError("Cannot configure backup for more than 100 VMs per policy")
# throw error if policy has more than 1000 protected VMs.
if policy.properties.protected_items_count >= 1000:
raise CLIError("Cannot configure backup for more than 1000 VMs per policy")

# Get container and item URIs
container_uri = _get_protection_container_uri_from_id(item.id)
Expand Down