Skip to content

Cannot delete multiple backup policies #28207

@jaredbrogan

Description

@jaredbrogan

Describe the bug

According to this documentation: https://learn.microsoft.com/en-us/cli/azure/backup/policy?view=azure-cli-latest#az-backup-policy-delete

I should be able to supply a space-delimited argument of one or more backup policy resource IDs when using the --ids parameter. When in reality, it only deletes the first ID in the argument.

Related command

az backup policy delete --ids "<id_1> <id2>"

Errors

No errors given.

Issue script & Debug output

az backup policy delete --ids "/subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test1 /subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test2" --debug
cli.knack.cli: Command arguments: ['backup', 'policy', 'delete', '--ids', '/subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test1 /subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test2', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f4ddcdb13a0>, <function OutputProducer.on_global_arguments at 0x7f4ddcd51da0>, <function CLIQuery.on_global_arguments at 0x7f4ddcd8f880>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'backup': ['azure.cli.command_modules.backup']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: backup                    0.006        16        60
cli.azure.cli.core: Total (1)                 0.006        16        60
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: Loaded 16 groups, 60 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : backup policy delete
cli.azure.cli.core: Command table: backup policy delete
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f4ddbc7cf40>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/jbrogan/.azure/commands/2024-01-16.15-45-11.backup_policy_delete.32241.log'.
az_command_data_logger: command args: backup policy delete --ids {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f4ddbcfd120>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f4ddbcfd1c0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f4ddbcfd300>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f4ddcd51e40>, <function CLIQuery.handle_query_parameter at 0x7f4ddcd8f920>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f4ddbcfd260>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=RecoveryServicesBackupClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/jbrogan/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/jbrogan/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/<redacted>/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/<redacted>/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/<redacted>/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/<redacted>/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/<redacted>/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/<redacted>/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/<redacted>/kerberos', 'tenant_region_scope': 'NA', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: d1c73b78-a729-4c4f-988c-d7fd58658195
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test1%20?api-version=2023-04-01'
cli.azure.cli.core.sdk.policies: Request method: 'DELETE'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '865a3a01-b4b8-11ee-9b8a-617298e21c0f'
cli.azure.cli.core.sdk.policies:     'CommandName': 'backup policy delete'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--ids --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.56.0 (DEB) azsdk-python-mgmt-recoveryservicesbackup/7.0.0 Python/3.11.5 (Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "DELETE /subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.RecoveryServices/vaults/test1/backupPolicies/test1%20?api-version=2023-04-01 HTTP/1.1" 200 0
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '4c1c3909-5caf-412d-a7dd-afd7eef06ed4'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '865a3a01-b4b8-11ee-9b8a-617298e21c0f'
cli.azure.cli.core.sdk.policies:     'Server': 'Kestrel'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-deletes': '14999'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '4c1c3909-5caf-412d-a7dd-afd7eef06ed4'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'CENTRALUS:20240116T214513Z:4c1c3909-5caf-412d-a7dd-afd7eef06ed4'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 16 Jan 2024 21:45:12 GMT'
cli.azure.cli.core.sdk.policies:     'Content-Length': '0'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies:
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7f4ddbcce340>, <function _x509_from_base64_to_hex_transform at 0x7f4ddbcce3e0>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f4ddbc7d1c0>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 1.959 seconds (init: 0.378, invoke: 1.582)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3420 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /home/jbrogan/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Both resources supplied to the --ids parameter are successfully deleted.

Environment Summary

az version
{
  "azure-cli": "2.56.0",
  "azure-cli-core": "2.56.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "account": "0.2.5",
    "appservice-kube": "0.1.8",
    "authV2": "0.1.2",
    "azure-devops": "0.26.0",
    "kusto": "0.5.0",
    "support": "1.0.3"
  }
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botRecovery Services Backupaz backupService AttentionThis issue is responsible by Azure service team.act-observability-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions