|
291 | 291 | - name: List of Recovery Points in a Vault |
292 | 292 | text: az dataprotection recovery-point list --backup-instance-name "sample_biname-00000000-0000-0000-0000-000000000000" --resource-group "sample_rg" --vault-name "sample_vault" |
293 | 293 | """ |
| 294 | + |
| 295 | +helps['dataprotection enable-backup'] = """ |
| 296 | + type: group |
| 297 | + short-summary: Enable backup for Azure resources. |
| 298 | +""" |
| 299 | + |
| 300 | +helps['dataprotection enable-backup trigger'] = """ |
| 301 | + type: command |
| 302 | + short-summary: Enable backup for an AKS cluster by setting up all required resources including backup vault, policy, storage account, extension, and trusted access. |
| 303 | + long-summary: | |
| 304 | + This command orchestrates all the steps required to enable backup for an AKS cluster: |
| 305 | + 1. Creates or reuses a backup resource group, storage account, and blob container |
| 306 | + 2. Installs the backup extension on the cluster (or reuses an existing one) |
| 307 | + 3. Creates or reuses a backup vault and backup policy |
| 308 | + 4. Configures trusted access and role assignments |
| 309 | + 5. Creates a backup instance |
| 310 | +
|
| 311 | + The --backup-configuration-file parameter accepts a JSON file (@file.json) or inline JSON string with the following optional settings: |
| 312 | + - storageAccountResourceId: ARM ID of an existing storage account to use |
| 313 | + - blobContainerName: Name of an existing blob container (used with storageAccountResourceId) |
| 314 | + - backupResourceGroupId: ARM ID of an existing resource group for backup resources |
| 315 | + - backupVaultId: ARM ID of an existing backup vault (required for Custom strategy) |
| 316 | + - backupPolicyId: ARM ID of an existing backup policy (required for Custom strategy) |
| 317 | + - tags: Dictionary of tags to apply to created resources (e.g., {"Owner": "team", "Env": "prod"}) |
| 318 | +
|
| 319 | + Backup strategy presets (--backup-strategy): |
| 320 | + - Week (default): Daily incremental backups with 7-day retention in Operational Store. |
| 321 | + - Month: Daily incremental backups with 30-day retention in Operational Store. |
| 322 | + - DisasterRecovery: Daily incremental backups with 7-day Operational Store + 90-day Vault Store retention. FirstOfDay backups are copied to Vault Store for cross-region restore. |
| 323 | + - Custom: Bring your own vault and policy. Requires backupVaultId and backupPolicyId in --backup-configuration-file. |
| 324 | + examples: |
| 325 | + - name: Enable backup for an AKS cluster with default Week strategy |
| 326 | + text: az dataprotection enable-backup trigger --datasource-type AzureKubernetesService --datasource-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.ContainerService/managedClusters/{cluster} |
| 327 | + - name: Enable backup with Month strategy |
| 328 | + text: az dataprotection enable-backup trigger --datasource-type AzureKubernetesService --datasource-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.ContainerService/managedClusters/{cluster} --backup-strategy Month |
| 329 | + - name: Enable backup with Custom strategy using existing vault and policy |
| 330 | + text: | |
| 331 | + az dataprotection enable-backup trigger --datasource-type AzureKubernetesService \\ |
| 332 | + --datasource-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.ContainerService/managedClusters/{cluster} \\ |
| 333 | + --backup-strategy Custom \\ |
| 334 | + --backup-configuration-file @config.json |
| 335 | +
|
| 336 | + Where config.json contains: |
| 337 | + { |
| 338 | + "backupVaultId": "/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DataProtection/backupVaults/{vault}", |
| 339 | + "backupPolicyId": "/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DataProtection/backupVaults/{vault}/backupPolicies/{policy}" |
| 340 | + } |
| 341 | + - name: Enable backup with resource tags for policy compliance |
| 342 | + text: | |
| 343 | + az dataprotection enable-backup trigger --datasource-type AzureKubernetesService \\ |
| 344 | + --datasource-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.ContainerService/managedClusters/{cluster} \\ |
| 345 | + --backup-configuration-file '{"tags": {"Owner": "team", "Environment": "prod", "DeleteBy": "2026-12"}}' |
| 346 | + - name: Enable backup using an existing storage account |
| 347 | + text: | |
| 348 | + az dataprotection enable-backup trigger --datasource-type AzureKubernetesService \\ |
| 349 | + --datasource-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.ContainerService/managedClusters/{cluster} \\ |
| 350 | + --backup-configuration-file @config.json |
| 351 | +
|
| 352 | + Where config.json contains: |
| 353 | + { |
| 354 | + "storageAccountResourceId": "/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{sa}", |
| 355 | + "blobContainerName": "my-backup-container" |
| 356 | + } |
| 357 | +""" |
0 commit comments