Skip to content

Commit fcfc92d

Browse files
author
Jill Grant
authored
Merge pull request #292757 from AbhishekMallick01/Jan-8-2025-Incubation-AKS
AKS backup via PS - Incubation <50 visitors addressed
2 parents 4b57d04 + dc6dca2 commit fcfc92d

6 files changed

+87
-74
lines changed

articles/backup/azure-kubernetes-service-backup-overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.service: azure-backup
66
ms.custom:
77
- ignite-2023
88
- ignite-2024
9-
ms.date: 09/09/2024
9+
ms.date: 01/16/2025
1010
author: AbhishekMallick-MS
1111
ms.author: v-abhmallick
1212
---
@@ -442,4 +442,5 @@ You incur charges for:
442442
## Next step
443443

444444
> [!div class="nextstepaction"]
445-
> [Prerequisites for Azure Kubernetes Service backup](azure-kubernetes-service-cluster-backup-concept.md)
445+
>- [Prerequisites for Azure Kubernetes Service backup](azure-kubernetes-service-cluster-backup-concept.md)
446+
>- [Back up AKS using Azure PowerShell](azure-kubernetes-service-cluster-backup-using-powershell.md)

articles/backup/azure-kubernetes-service-cluster-backup-concept.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ Also, as part of the backup and restore operations, the following roles are assi
119119

120120
- [About Azure Kubernetes Service backup](azure-kubernetes-service-backup-overview.md)
121121
- [Supported scenarios for Azure Kubernetes Service cluster backup](azure-kubernetes-service-cluster-backup-support-matrix.md)
122-
- [Back up Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-backup.md)
122+
- Back up Azure Kubernetes Service cluster using [Azure portal](azure-kubernetes-service-cluster-backup.md), [Azure PowerShell](azure-kubernetes-service-cluster-backup-using-powershell.md)
123123
- [Restore Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-restore.md)
124124
- [Manage Azure Kubernetes Service cluster backups](azure-kubernetes-service-cluster-manage-backups.md)

articles/backup/azure-kubernetes-service-cluster-backup-using-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Back up Azure Kubernetes Service (AKS) using Azure CLI
33
description: This article explains how to back up Azure Kubernetes Service (AKS) using Azure CLI.
44
ms.topic: how-to
55
ms.service: azure-backup
6-
ms.date: 02/27/2024
6+
ms.date: 01/16/2025
77
ms.custom:
88
- devx-track-azurecli
99
- ignite-2023
@@ -14,7 +14,7 @@ ms.author: v-abhmallick
1414

1515
# Back up Azure Kubernetes Service using Azure CLI
1616

17-
This article describes how to configure and back up Azure Kubernetes Service (AKS) using Azure CLI.
17+
This article describes how to configure and back up Azure Kubernetes Service (AKS) using Azure CLI. You can also back up AKS using [Azure PowerShell](azure-kubernetes-service-cluster-backup-using-powershell.md).
1818

1919
Azure Backup now allows you to back up AKS clusters (cluster resources and persistent volumes attached to the cluster) using a backup extension, which must be installed in the cluster. Backup vault communicates with the cluster via this Backup Extension to perform backup and restore operations.
2020

articles/backup/azure-kubernetes-service-cluster-backup-using-powershell.md

Lines changed: 77 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Back up Azure Kubernetes Service (AKS) using Azure PowerShell
33
description: This article explains how to back up Azure Kubernetes Service (AKS) using PowerShell.
44
ms.topic: how-to
55
ms.service: azure-backup
6-
ms.date: 04/07/2024
6+
ms.date: 01/20/2025
77
ms.custom:
88
- devx-track-azurepowershell
99
- ignite-2023
@@ -21,6 +21,8 @@ Azure Backup now allows you to back up AKS clusters (cluster resources and persi
2121

2222
## Before you start
2323

24+
Before you start backing up an AKS cluster, ensure that you review the following prerequisites:
25+
2426
- Currently, AKS backup supports Azure Disk-based persistent volumes (enabled by CSI driver) only. The backups are stored only in operational datastore (in your tenant) and aren't moved to a vault. The Backup vault and AKS cluster should be in the same region.
2527

2628
- AKS backup uses a blob container and a resource group to store the backups. The blob container has the AKS cluster resources stored in it, whereas the persistent volume snapshots are stored in the resource group. The AKS cluster and the storage locations must reside in the same region. Learn [how to create a blob container](../storage/blobs/storage-quickstart-blobs-portal.md#create-a-container).
@@ -64,47 +66,52 @@ Once the vault creation is complete, create a backup policy to protect AKS clust
6466

6567
## Create a backup policy
6668

67-
To understand the inner components of a backup policy for the backup of AKS, retrieve the policy template using the cmdlet `Get-AzDataProtectionPolicyTemplate`. This command returns a default policy template for a given datasource type. Use this policy template to create a new policy.
69+
Azure Backup enables you to create backup policies for AKS Cluster protection with **Daily backups** or **Multiple backups per day**.
6870

69-
```azurepowershell
70-
$policyDefn = Get-AzDataProtectionPolicyTemplate -DatasourceType AzureKubernetesService
71-
```
71+
To create a backup policy for AKS Cluster, run the following cmdlets:
7272

73-
The policy template consists of a trigger criteria (which decides the factors to trigger the backup job) and a lifecycle (which decides when to delete, copy, or move the backups). In AKS backup, the default value for trigger is a scheduled hourly trigger is *every 4 hours (PT4H)* and retention of each backup is *7 days*.
73+
1. Fetch the policy template using the cmdlet `Get-AzDataProtectionPolicyTemplate` and check the inner components of a backup policy for the backup of AKS. This command returns a default policy template for a given datasource type. Use this policy template to create a new policy.
7474

75+
```azurepowershell
76+
$policyDefn = Get-AzDataProtectionPolicyTemplate -DatasourceType AzureKubernetesService
77+
```
7578
76-
```azurepowershell
77-
$policyDefn.PolicyRule[0]. Trigger | fl
79+
The policy template consists of a trigger criteria (which decides the factors to trigger the backup job) and a lifecycle (which decides when to delete, copy, or move the backups). In AKS backup, the default value for trigger is a scheduled hourly trigger is *every 4 hours (PT4H)* and retention of each backup is *7 days*.
7880
79-
ObjectType: ScheduleBasedTriggerContext
80-
ScheduleRepeatingTimeInterval: {R/2023-04-05T13:00:00+00:00/PT4H}
81-
TaggingCriterion: {Default}
81+
```azurepowershell
82+
$policyDefn.PolicyRule[0]. Trigger | fl
8283
83-
$policyDefn.PolicyRule[1]. Lifecycle | fl
84+
ObjectType: ScheduleBasedTriggerContext
85+
ScheduleRepeatingTimeInterval: {R/2023-04-05T13:00:00+00:00/PT4H}
86+
TaggingCriterion: {Default}
8487
85-
DeleteAfterDuration: P7D
86-
DeleteAfterObjectType: AbsoluteDeleteOption
87-
SourceDataStoreObjectType : DataStoreInfoBase
88-
SourceDataStoreType: OperationalStore
89-
TargetDataStoreCopySetting:
90-
```
88+
$policyDefn.PolicyRule[1]. Lifecycle | fl
9189
92-
Backup for AKS provides multiple backups per day. The backups are equally distributed across the day, if you require more frequent backups by choosing the *Hourly backup frequency* that has the ability to take backups with intervals of every *4*, *6*, *8*, or *12* hours. The backups are scheduled based on the *Time interval* you've selected. For example, if you select *Every 4 hours*, then the backups are taken at approximately in the interval of *every 4 hours*.
90+
DeleteAfterDuration: P7D
91+
DeleteAfterObjectType: AbsoluteDeleteOption
92+
SourceDataStoreObjectType : DataStoreInfoBase
93+
SourceDataStoreType: OperationalStore
94+
TargetDataStoreCopySetting:
95+
```
9396
94-
If *once a day backup* is sufficient, then choose the *Daily backup frequency*. In the daily backup frequency, you can specify the *time of the day* when your backups should be taken.
97+
2. For the **Daily backup frequency**, specify the *time of the day* when your backups should be taken.
9598
96-
> [!IMPORTANT]
97-
> The time of the day indicates the backup start time and not the time when the backup completes. The time required for completing the backup operation is dependent on various factors, including number and size of the persistent volumes and churn rate between consecutive backups.
99+
> [!IMPORTANT]
100+
> The time of the day indicates the backup start time and not the time when the backup completes. The time required for completing the backup operation is dependent on various factors, including number and size of the persistent volumes and churn rate between consecutive backups.
98101
99-
If you want to edit the hourly frequency or the retention period, use the `Edit-AzDataProtectionPolicyTriggerClientObject` and/or `Edit-AzDataProtectionPolicyRetentionRuleClientObject` cmdlets. Once the policy object has all the required values, start creating a new policy from the policy object using the `New-AzDataProtectionBackupPolicy` cmdlet.
100102
103+
Backup for AKS provides multiple backups per day. The backups are equally distributed across the day, if you require more frequent backups by choosing the *Hourly backup frequency* that has the ability to take backups with intervals of every *4*, *6*, *8*, or *12* hours. The backups are scheduled based on the *Time interval* you've selected. For example, if you select *Every 4 hours*, then the backups are taken at approximately in the interval of *every 4 hours*.
101104
102105
103-
```azurepowershell
104-
New-AzDataProtectionBackupPolicy -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name aksBkpPolicy -Policy $policyDefn
106+
3. If you want to edit the hourly frequency or the retention period, use the `Edit-AzDataProtectionPolicyTriggerClientObject` and/or `Edit-AzDataProtectionPolicyRetentionRuleClientObject` cmdlets. Once the policy object has all the required values, start creating a new policy from the policy object using the `New-AzDataProtectionBackupPolicy` cmdlet.
105107
106-
$aksBkpPol = Get-AzDataProtectionBackupPolicy -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name "aksBkpPolicy"
107-
```
108+
109+
110+
```azurepowershell
111+
New-AzDataProtectionBackupPolicy -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name aksBkpPolicy -Policy $policyDefn
112+
113+
$aksBkpPol = Get-AzDataProtectionBackupPolicy -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name "aksBkpPolicy"
114+
```
108115
109116
## Prepare AKS cluster for backup
110117
@@ -175,59 +182,64 @@ The configuration of backup is performed in two steps:
175182

176183
### Assign required permissions and validate
177184

178-
With the request prepared, you need to assign the user the required permissions via Azure role-based access control (Azure RBAC) to vault (represented by vault managed system identity) and the AKS cluster. You can perform this using the `Set-AzDataProtectionMSIPermission` cmdlet. Backup vault uses managed identity to access other Azure resources. To configure backup of AKS cluster, Backup vault's managed identity requires a set of permissions on the AKS cluster and resource groups, where snapshots are created and managed. Also, the AKS cluster requires permission on the snapshot resource group.
185+
To assign the required permissions and perform validation for the AKS cluster protection, run the following cmdlets:
179186

180-
Only, system-assigned managed identity is currently supported for backup (both Backup vault and AKS cluster). A system-assigned managed identity is restricted to one per resource and is tied to the lifecycle of this resource. You can grant permissions to the managed identity by using Azure RBAC. Managed identity is a service principal of a special type that may only be used with Azure resources. Learn more [about managed identities](../active-directory/managed-identities-azure-resources/overview.md).
187+
1. With the request prepared, you need to assign the user the required permissions via Azure role-based access control (Azure RBAC) to vault (represented by vault managed system identity) and the AKS cluster. You can perform this using the `Set-AzDataProtectionMSIPermission` cmdlet. Backup vault uses managed identity to access other Azure resources. To configure backup of AKS cluster, Backup vault's managed identity requires a set of permissions on the AKS cluster and resource groups, where snapshots are created and managed. Also, the AKS cluster requires permission on the snapshot resource group.
181188

182-
```azurepowershell
183-
Set-AzDataProtectionMSIPermission -BackupInstance $backupInstance -VaultResourceGroup $rgName -VaultName $vaultName -PermissionsScope "ResourceGroup"
184-
```
189+
>[!Note]
190+
>Only, system-assigned managed identity is currently supported for backup (both Backup vault and AKS cluster). A system-assigned managed identity is restricted to one per resource and is tied to the lifecycle of this resource. You can grant permissions to the managed identity by using Azure RBAC. Managed identity is a service principal of a special type that may only be used with Azure resources. Learn more [about managed identities](../active-directory/managed-identities-azure-resources/overview.md).
185191
186-
Once permissions are assigned, run the following cmdlet to test the readiness of the instance created.
192+
```azurepowershell
193+
Set-AzDataProtectionMSIPermission -BackupInstance $backupInstance -VaultResourceGroup $rgName -VaultName $vaultName -PermissionsScope "ResourceGroup"
194+
```
187195
188-
```azurepowershell
189-
test-AzDataProtectionBackupInstanceReadiness -ResourceGroupName $resourceGroupName -VaultName $vaultName -BackupInstance $backupInstance.Property
190-
```
196+
2. Once permissions are assigned, test the readiness of the instance created.
191197
192-
When the validation is successful, you can submit the request to protect the AKS cluster using the `New-AzDataProtectionBackupInstance` cmdlet.
198+
```azurepowershell
199+
test-AzDataProtectionBackupInstanceReadiness -ResourceGroupName $resourceGroupName -VaultName $vaultName -BackupInstance $backupInstance.Property
200+
```
193201
194-
```azurepowershell
195-
New-AzDataProtectionBackupInstance -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -BackupInstance $backupInstance
196-
```
202+
3. When the validation is successful, submit the request to protect the AKS cluster using the `New-AzDataProtectionBackupInstance` cmdlet.
203+
204+
```azurepowershell
205+
New-AzDataProtectionBackupInstance -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -BackupInstance $backupInstance
206+
```
197207
198208
## Run an on-demand backup
199209
200-
To fetch the relevant backup instance on which you want to trigger a backup, run the `Get-AzDataProtectionBackupInstance` cmdlet.
210+
To trigger an on-demand backup, run the following cmdlets:
201211
202-
```azurepowershell
203-
$instance = Get-AzDataProtectionBackupInstance -SubscriptionId "xxxx-xxx-xxx" -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name "BackupInstanceName"
204-
```
212+
1. Fetch the relevant backup instance on which you want to trigger a backup by running the `Get-AzDataProtectionBackupInstance` cmdlet.
205213
206-
You can specify a retention rule while triggering the backup. To view the retention rules in policy, go to the policy object for retention rules. In the following example, the rule with name *default* appears and we'll use that rule for the on-demand backup.
214+
```azurepowershell
215+
$instance = Get-AzDataProtectionBackupInstance -SubscriptionId "xxxx-xxx-xxx" -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -Name "BackupInstanceName"
216+
```
207217
208-
```azurepowershell
209-
$policyDefn.PolicyRule | fl
210-
BackupParameter: Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.AzureBackupParams
211-
BackupParameterObjectType: AzureBackupParams
212-
DataStoreObjectType: DataStoreInfoBase
213-
DataStoreType: OperationalStore
214-
Name: BackupHourly
215-
ObjectType: AzureBackupRule
216-
Trigger: Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.ScheduleBasedTriggerContext
217-
TriggerObjectType: ScheduleBasedTriggerContext
218-
IsDefault: True
219-
Lifecycle: {Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.SourceLifeCycle}
220-
Name: Default
221-
ObjectType: AzureRetentionRule
222-
```
218+
2. Specify a retention rule while triggering the backup. To view the retention rules in policy, go to the policy object for retention rules. In the following example, the rule with name *default* appears and we'll use that rule for the on-demand backup.
223219
224-
Now, trigger an on-demand backup using the `Backup-AzDataProtectionBackupInstanceAdhoc` cmdlet.
220+
```azurepowershell
221+
$policyDefn.PolicyRule | fl
222+
BackupParameter: Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.AzureBackupParams
223+
BackupParameterObjectType: AzureBackupParams
224+
DataStoreObjectType: DataStoreInfoBase
225+
DataStoreType: OperationalStore
226+
Name: BackupHourly
227+
ObjectType: AzureBackupRule
228+
Trigger: Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.ScheduleBasedTriggerContext
229+
TriggerObjectType: ScheduleBasedTriggerContext
230+
IsDefault: True
231+
Lifecycle: {Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.SourceLifeCycle}
232+
Name: Default
233+
ObjectType: AzureRetentionRule
234+
```
225235
226-
```azurepowershell
227-
$AllInstances = Get-AzDataProtectionBackupInstance -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name
236+
3. Trigger an on-demand backup using the `Backup-AzDataProtectionBackupInstanceAdhoc` cmdlet.
228237
229-
Backup-AzDataProtectionBackupInstanceAdhoc -BackupInstanceName $AllInstances[0].Name -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -BackupRuleOptionRuleName "Default"
230-
```
238+
```azurepowershell
239+
$AllInstances = Get-AzDataProtectionBackupInstance -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name
240+
241+
Backup-AzDataProtectionBackupInstanceAdhoc -BackupInstanceName $AllInstances[0].Name -ResourceGroupName "testBkpVaultRG" -VaultName $TestBkpVault.Name -BackupRuleOptionRuleName "Default"
242+
```
231243
232244
## Tracking jobs
233245

articles/backup/azure-kubernetes-service-cluster-backup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: Back up Azure Kubernetes Service by using Azure Backup
33
description: Learn how to back up Azure Kubernetes Service (AKS) by using Azure Backup.
44
ms.topic: how-to
55
ms.service: azure-backup
6-
ms.date: 11/04/2024
6+
ms.date: 01/16/2025
77
author: AbhishekMallick-MS
88
ms.author: v-abhmallick
99
---
1010

1111
# Back up Azure Kubernetes Service by using Azure Backup
1212

13-
This article describes how to configure and back up Azure Kubernetes Service (AKS).
13+
This article describes how to configure and back up Azure Kubernetes Service (AKS) using Azure portal. You can also backup AKS [using Azure PowerShell](azure-kubernetes-service-cluster-backup-using-powershell.md).
1414

1515
You can use Azure Backup to back up AKS clusters (cluster resources and persistent volumes attached to the cluster) by using the Backup extension, which must be installed in the cluster. The Backup vault communicates with the cluster via the Backup extension to perform backup and restore operations.
1616

articles/backup/azure-kubernetes-service-cluster-manage-backups.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.custom:
77
- devx-track-azurecli
88
- ignite-2023
99
- ignite-2024
10-
ms.date: 02/28/2024
10+
ms.date: 01/16/2025
1111
author: AbhishekMallick-MS
1212
ms.author: v-abhmallick
1313
---
@@ -309,6 +309,6 @@ To delete an AKS cluster backup instance, follow these steps:
309309

310310
## Next steps
311311

312-
- [Back up Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-backup.md)
312+
- Back up Azure Kubernetes Service cluster using [Azure portal]](azure-kubernetes-service-cluster-backup.md), [Azure PowerShell](azure-kubernetes-service-cluster-backup-using-powershell.md)
313313
- [Restore Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-restore.md)
314314
- [Supported scenarios for backing up Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-backup-support-matrix.md)

0 commit comments

Comments
 (0)