Skip to content

API issues with AZ CLI dataprotection backup-instance restore initialize-for-item-recovery cmd #30880

@DevinYPracticeWilliams

Description

@DevinYPracticeWilliams

Describe the bug

When I attempt to run the dataprotection backup-instance restore initialize-for-item-recovery command against my subscription, I get this error:

ERROR: (InvalidApiVersionParameter) The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'. Code: InvalidApiVersionParameter Message: The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.: {"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}} Restore configuration written to restoreconfig.json successfully.

From what I understand, the API doesn't have enough information to complete the request and needs another parameter filled to finish it. There was a similar issue with accessing the key vault. The solution for this problem was to add a --resource-group to the command, however, this command does not have a --resource-group parameter and adding one fails. What do I need to do to fix this problem, as this command and az upgrade do not work

Related command

az dataprotection backup-instance restore initialize-for-item-recovery

Errors

ERROR: (InvalidApiVersionParameter) The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.
Code: InvalidApiVersionParameter
Message: The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.: {"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2024-04-01' is invalid. The supported versions are '2024-11-01,2024-08-01,2024-07-01,2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}
Restore configuration written to restoreconfig.json successfully.

Issue script & Debug output

`clusterName=$AKS_CLUSTER_NAME
subscriptionId=$SUBSCRIPTION_ID
backupVault=$BVAULT
rgName=$RGNAME
region=$REGION

az upgrade

Write the restore configuration to a JSON file

restoreConfig=$(jq -n --argjson config '{
conflict_policy: "Skip",
excluded_namespaces: null,
excluded_resource_types: null,
include_cluster_scope_resources: true,
included_namespaces: null,
included_resource_types: null,
label_selectors: null,
namespace_mappings: null,
object_type: "KubernetesClusterRestoreCriteria",
persistent_volume_restore_mode: "RestoreWithVolumeData",
resource_modifier_reference: null,
restore_hook_references: null,
staging_resource_group_id: null,
staging_storage_account_id: null
}' '$config')

if echo $restoreConfig | jq . > restoreconfig.json; then
echo "Restore configuration written to restoreconfig.json successfully."
else
echo "Failed to write restore configuration to restoreconfig.json."
exit 1
fi

Get JSON output

jsonOutput=$(az dataprotection backup-instance list-from-resourcegraph --datasource-type "AzureKubernetesService" --datasource-id "/subscriptions/$subscriptionId/resourceGroups/$rgName/providers/Microsoft.ContainerService/managedClusters/$clusterName")

Parse JSON and extract the latest instance name

latestInstanceName=$(echo $jsonOutput | jq -r '.[0].name')

Print the latest instance name

echo "Latest instance name: $latestInstanceName"

Get the list of recovery points for the latest instance

recoveryPointsJson=$(az dataprotection recovery-point list --backup-instance-name $latestInstanceName --resource-group $rgName --vault-name $backupVault)

Parse JSON and extract the latest recovery point details

latestRecoveryPoint=$(echo $recoveryPointsJson | jq -r 'sort_by(.properties.recoveryPointTime) | last')

Extract the name and creation time of the latest recovery point

recoveryPointName=$(echo $latestRecoveryPoint | jq -r '.name')
recoveryPointCreationTime=$(echo $latestRecoveryPoint | jq -r '.properties.recoveryPointTime')
recoveryPointID=$(echo $latestRecoveryPoint | jq -r '.id')

Print the latest recovery point details

echo "Latest recovery point name: $recoveryPointName"
echo "Latest recovery point creation time: $recoveryPointCreationTime"
echo "Latest recovery point ID: $recoveryPointID"

backupInstanceID="/subscriptions/$subscriptionId/resourceGroups/$rgName/providers/Microsoft.DataProtection/backupVaults/$backupVault/backupInstances/$latestInstanceName"
echo "Backup Instance ID: $backupInstanceID"

Initialize restore configuration

if az dataprotection backup-instance initialize-restoreconfig --datasource-type AzureKubernetesService > restoreconfig.json; then
echo "Restore configuration initialized successfully."
else
echo "Failed to initialize restore configuration."
exit 1
fi

Initialize item recovery

if az dataprotection backup-instance restore initialize-for-item-recovery --datasource-type AzureKubernetesService --restore-location $region --source-datastore OperationalStore --recovery-point-id $recoveryPointID --backup-instance-id $backupInstanceID --restore-configuration restoreconfig.json > restorerequestobject.json; then
echo "Item recovery initialized successfully."
else
echo "Failed to initialize item recovery."
exit 1
fi

`

Expected behavior

Update the current JSON with the newest reserve instance to prepare to restore the AKS cluster to the next backup.

Environment Summary

azure-cli 2.68.0 *

core 2.68.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.1
k8s-extension 1.6.3

Dependencies:
msal 1.31.1
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.12.8 (main, Jan 8 2025, 03:38:17) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botService AttentionThis issue is responsible by Azure service team.Upgradeaz upgradebugThis 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