Skip to content

Commit 58d1e49

Browse files
authored
Merge pull request #293822 from AbhishekMallick01/Jan-30-2025-IncubationAKS
Incubation <50 visitors - AKS restore using PS
2 parents 7acde8a + 736c41c commit 58d1e49

6 files changed

+78
-68
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.topic: overview
55
ms.service: azure-backup
66
ms.custom:
77
- ignite-2023
8-
ms.date: 01/21/2025
8+
ms.date: 01/30/2025
99
author: jyothisuri
1010
ms.author: jsuri
1111
---
@@ -120,5 +120,5 @@ Also, as part of the backup and restore operations, the following roles are assi
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)
122122
- 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)
123-
- Restore Azure Kubernetes Service cluster using [Azure portal](azure-kubernetes-service-cluster-restore.md), [Azure CLI](azure-kubernetes-service-cluster-restore-using-cli.md)
123+
- Restore Azure Kubernetes Service cluster using [Azure portal](azure-kubernetes-service-cluster-restore.md), [Azure CLI](azure-kubernetes-service-cluster-restore-using-cli.md), [Azure PowerShell](azure-kubernetes-service-cluster-restore-using-powershell.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: 01/16/2025
6+
ms.date: 01/30/2025
77
ms.custom:
88
- devx-track-azurecli
99
- ignite-2023
@@ -325,6 +325,6 @@ az dataprotection job list-from-resourcegraph --datasource-type AzureKubernetesS
325325

326326
## Next steps
327327

328-
- [Restore Azure Kubernetes Service cluster using Azure CLI](azure-kubernetes-service-cluster-restore-using-cli.md)
328+
- Restore Azure Kubernetes Service cluster using [Azure CLI](azure-kubernetes-service-cluster-restore-using-cli.md), [Azure PowerShell](azure-kubernetes-service-cluster-restore-using-powershell.md)
329329
- [Manage Azure Kubernetes Service cluster backups](azure-kubernetes-service-cluster-manage-backups.md)
330330
- [About Azure Kubernetes Service cluster backup](azure-kubernetes-service-cluster-backup-concept.md)

articles/backup/azure-kubernetes-service-cluster-backup.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 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: 01/16/2025
6+
ms.date: 01/30/2025
77
author: jyothisuri
88
ms.author: jsuri
99
---
@@ -212,6 +212,6 @@ To enable a backup hook as part of the backup configuration flow to back up MySQ
212212

213213
## Next steps
214214

215-
- [Restore an Azure Kubernetes Service cluster](azure-kubernetes-service-cluster-restore.md)
215+
- Restore an Azure Kubernetes Service cluster using [Azure portal](azure-kubernetes-service-cluster-restore.md), [Azure PowerShell](azure-kubernetes-service-cluster-restore-using-powershell.md)
216216
- [Manage Azure Kubernetes Service cluster backups](azure-kubernetes-service-cluster-manage-backups.md)
217217
- [About Azure Kubernetes Service cluster backup](azure-kubernetes-service-cluster-backup-concept.md)

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

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

1515
# Restore Azure Kubernetes Service using Azure CLI
1616

17-
This article describes how to restore Azure Kubernetes cluster from a restore point created by Azure Backup using Azure CLI.
17+
This article describes how to restore Azure Kubernetes cluster from a restore point created by Azure Backup using Azure CLI. You can also restore AKS cluster using [Azure PowerShell](azure-kubernetes-service-cluster-restore-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

Lines changed: 68 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Restore Azure Kubernetes Service (AKS) using PowerShell
2+
title: Restore Azure Kubernetes Service (AKS) via PowerShell using Azure Backup
33
description: This article explains how to restore backed-up Azure Kubernetes Service (AKS) using Azure PowerShell.
44
ms.topic: how-to
55
ms.service: azure-backup
6-
ms.date: 05/13/2024
6+
ms.date: 01/30/2025
77
ms.custom:
88
- devx-track-azurepowershell
99
- ignite-2023
@@ -16,14 +16,26 @@ ms.author: jsuri
1616

1717
This article describes how to restore Azure Kubernetes cluster from a restore point created by Azure Backup using Azure PowerShell.
1818

19-
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.
19+
Azure Backup supports backing up AKS clusters, including cluster resources and attached persistent volumes, using a backup extension. This extension must be installed in the cluster, enabling the Backup Vault to communicate with it to perform backup and restore operations.
2020

21-
You can perform both *Original-Location Recovery (OLR)* (restoring in the AKS cluster that was backed up) and *Alternate-Location Recovery (ALR)* (restoring in a different AKS cluster). You can also select the items to be restored from the backup that is Item-Level Recovery (ILR).
21+
You can perform *Original-Location Recovery (OLR)* in the same AKS cluster or *Alternate-Location Recovery (ALR)* in a different AKS cluster. Item-Level Recovery (ILR) lets you select specific items to restore from the backup.
2222

2323
>[!Note]
24-
>Before you initiate a restore operation, the target cluster should have Backup Extension installed and Trusted Access enabled for the Backup vault. [Learn more](azure-kubernetes-service-cluster-backup-using-powershell.md#prepare-aks-cluster-for-backup).
24+
>Before you initiate a restore operation, ensure that the target cluster has Backup Extension installed and Trusted Access enabled for the Backup vault. [Learn more](azure-kubernetes-service-cluster-backup-using-powershell.md#prepare-aks-cluster-for-backup).
2525
26-
Initialize the variables with required details related to each resource to be used in commands:
26+
## Prerequisites
27+
28+
Before you restore an AKS cluster, ensure that you meet the following prerequisites:
29+
30+
- AKS backup allows you to restore to original AKS cluster (that was backed up) and to an alternate AKS cluster. AKS backup allows you to perform a full restore and item-level restore. You can utilize [restore configurations](#restore-to-an-aks-cluster) to define parameters based on the cluster resources for restore.
31+
32+
- You must [install the Backup Extension](azure-kubernetes-service-cluster-manage-backups.md#install-backup-extension) in the target AKS cluster. Also, you must [enable Trusted Access](azure-kubernetes-service-cluster-manage-backups.md#trusted-access-related-operations) between the Backup vault and the AKS cluster.
33+
34+
For more information on the limitations and supported scenarios, see the [support matrix](azure-kubernetes-service-cluster-backup-support-matrix.md).
35+
36+
## Initialize Variables for Resource Commands
37+
38+
Here, provide the necessary details for each resource to be used in your commands.
2739

2840
- Subscription ID of the Backup Vault
2941

@@ -47,95 +59,93 @@ Initialize the variables with required details related to each resource to be us
4759
$restoreLocation = "vaultRegion" #example eastus
4860
```
4961
50-
- ID of the target AKS cluster, in case the restore will be performed to an alternate AKS cluster
62+
- ID of the target AKS cluster, in case the restore is performed to an alternate AKS cluster
5163
5264
```azurepowershell
5365
$targetAKSClusterId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx/resourceGroups/targetrg/providers/Microsoft.ContainerService/managedClusters/PSAKSCluster2"
5466
```
5567
56-
## Before you start
57-
58-
- AKS backup allows you to restore to original AKS cluster (that was backed up) and to an alternate AKS cluster. AKS backup allows you to perform a full restore and item-level restore. You can utilize [restore configurations](#restore-to-an-aks-cluster) to define parameters based on the cluster resources that will be restored.
59-
60-
- You must [install the Backup Extension](azure-kubernetes-service-cluster-manage-backups.md#install-backup-extension) in the target AKS cluster. Also, you must [enable Trusted Access](azure-kubernetes-service-cluster-manage-backups.md#trusted-access-related-operations) between the Backup vault and the AKS cluster.
61-
62-
For more information on the limitations and supported scenarios, see the [support matrix](azure-kubernetes-service-cluster-backup-support-matrix.md).
63-
6468
## Restore to an AKS cluster
6569
6670
### Fetch the relevant recovery point
6771
68-
Fetch all instances using the `Get-AzDataProtectionBackupInstance` cmdlet and identify the relevant instance.
72+
To fetch the relevant recovery points, run the following cmdlets:
6973
70-
```azurepowershell
71-
$AllInstances = Get-AzDataProtectionBackupInstance -ResourceGroupName $vaultRgName -VaultName $vaultName
72-
```
74+
1. Fetch all instances using the `Get-AzDataProtectionBackupInstance` cmdlet and identify the relevant instance.
75+
76+
```azurepowershell
77+
$AllInstances = Get-AzDataProtectionBackupInstance -ResourceGroupName $vaultRgName -VaultName $vaultName
78+
```
7379
74-
You can also use `Az.Resourcegraph` and `Search-AzDataProtectionBackupInstanceInAzGraph` cmdlets to search across instances in multiple vaults and subscriptions.
80+
To search across instances in multiple vaults and subscriptions, use `Az.Resourcegraph` and `Search-AzDataProtectionBackupInstanceInAzGraph` cmdlets.
7581
76-
```azurepowershell
77-
$AllInstances = Search-AzDataProtectionBackupInstanceInAzGraph -Subscription $vaultSubId -ResourceGroup $vaultRgName -Vault $vaultName -DatasourceType AzureKubernetesService -ProtectionStatus ProtectionConfigured
78-
```
82+
```azurepowershell
83+
$AllInstances = Search-AzDataProtectionBackupInstanceInAzGraph -Subscription $vaultSubId -ResourceGroup $vaultRgName -Vault $vaultName -DatasourceType AzureKubernetesService -ProtectionStatus ProtectionConfigured
84+
```
7985

80-
Once the instance is identified, fetch the relevant recovery point. Supposedly, from the output array of the above command, third backup instance is to be restored.
86+
2. Once the instance is identified, fetch the relevant recovery point. From the output array of the given cmdlet, third backup instance is to be restored.
8187

82-
```azurepowershell
83-
$rp = Get-AzDataProtectionRecoveryPoint -ResourceGroupName $vaultRgName -VaultName $vaultName -BackupInstanceName $AllInstances[2].BackupInstanceName
84-
```
88+
```azurepowershell
89+
$rp = Get-AzDataProtectionRecoveryPoint -ResourceGroupName $vaultRgName -VaultName $vaultName -BackupInstanceName $AllInstances[2].BackupInstanceName
90+
```
8591
8692
### Prepare the restore request
8793
88-
Use the `New-AzDataProtectionRestoreConfigurationClientObject` cmdlet to prepare the restore configuration and defining the items to be restored to the target AKS cluster.
94+
To prepare the restore request, run the following cmdlets:
8995
90-
```azurepowershell
91-
$aksRestoreCriteria = New-AzDataProtectionRestoreConfigurationClientObject -DatasourceType AzureKubernetesService  -PersistentVolumeRestoreMode RestoreWithVolumeData  -IncludeClusterScopeResource $true -NamespaceMapping  @{"sourceNamespace"="targetNamespace"}
92-
```
96+
1. Prepare the restore configuration and define the items to be restored to the target AKS cluster by using the `New-AzDataProtectionRestoreConfigurationClientObject` cmdlet.
9397
94-
Then, use the `Initialize-AzDataProtectionRestoreRequest` cmdlet to prepare the restore request with all relevant details.
98+
```azurepowershell
99+
$aksRestoreCriteria = New-AzDataProtectionRestoreConfigurationClientObject -DatasourceType AzureKubernetesService  -PersistentVolumeRestoreMode RestoreWithVolumeData  -IncludeClusterScopeResource $true -NamespaceMapping  @{"sourceNamespace"="targetNamespace"}
100+
```
95101
96-
In case you want to perform restore to the original AKS cluster backedup, use the below format for the cmdlet
102+
2. Prepare the restore request with all relevant details by using the `Initialize-AzDataProtectionRestoreRequest` cmdlet.
97103
98-
```azurepowershell
99-
$aksRestoreRequest = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureKubernetesService -SourceDataStore OperationalStore -RestoreLocation $restoreLocation -RestoreType OriginalLocation -RecoveryPoint $rp[0].Property.RecoveryPointId -RestoreConfiguration $aksRestoreCriteria -BackupInstance $AllInstances[2]
100-
```
101-
In case you want to perform restore to an alternate AKS cluster, use the below format for the cmdlet
104+
For restore to the original AKS cluster, use the following cmdlet format:
102105
103-
```azurepowershell
104-
$aksRestoreRequest = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureKubernetesService -SourceDataStore OperationalStore -RestoreLocation $restoreLocation -RestoreType AlternateLocation -TargetResourceId $targetAKSClusterId -RecoveryPoint $rp[0].Property.RecoveryPointId -RestoreConfiguration $aksRestoreCriteria -BackupInstance $AllInstances[2]
105-
```
106+
```azurepowershell
107+
$aksRestoreRequest = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureKubernetesService -SourceDataStore OperationalStore -RestoreLocation $restoreLocation -RestoreType OriginalLocation -RecoveryPoint $rp[0].Property.RecoveryPointId -RestoreConfiguration $aksRestoreCriteria -BackupInstance $AllInstances[2]
108+
```
109+
For restore to an alternate AKS cluster, use the following cmdlet format:
110+
111+
```azurepowershell
112+
$aksRestoreRequest = Initialize-AzDataProtectionRestoreRequest -DatasourceType AzureKubernetesService -SourceDataStore OperationalStore -RestoreLocation $restoreLocation -RestoreType AlternateLocation -TargetResourceId $targetAKSClusterId -RecoveryPoint $rp[0].Property.RecoveryPointId -RestoreConfiguration $aksRestoreCriteria -BackupInstance $AllInstances[2]
113+
```
106114
107115
## Trigger the restore
108116
109-
Before you trigger the restore operation, validate the restore request created earlier.
117+
To trigger the restore operation, run the following cmdlets:
110118
111-
```azurepowershell
112-
$validateRestore = Test-AzDataProtectionBackupInstanceRestore -SubscriptionId $vaultSubId -ResourceGroupName $vaultRgName -VaultName $vaultName -RestoreRequest $aksRestoreRequest -Name $AllInstances[2].BackupInstanceName
113-
```
119+
1. Validate the restore request created earlier.
114120
115-
>[!Note]
116-
>During the restore operation, the Backup vault and the AKS cluster need to have certain roles assigned to perform the restore:
121+
```azurepowershell
122+
$validateRestore = Test-AzDataProtectionBackupInstanceRestore -SubscriptionId $vaultSubId -ResourceGroupName $vaultRgName -VaultName $vaultName -RestoreRequest $aksRestoreRequest -Name $AllInstances[2].BackupInstanceName
123+
```
117124
118-
1. *Target AKS* cluster should have *Contributor* role on the *Snapshot Resource Group*.
119-
2. The *User Identity* attached with the Backup Extension should have *Storage Account Contributor* roles on the *storage account* where backups are stored.
120-
3. The *Backup vault* should have a *Reader* role on the *Target AKS cluster* and *Snapshot Resource Group*.
125+
>[!Note]
126+
>During the restore operation, the Backup vault and the AKS cluster need to have certain roles assigned to perform the restore:
121127
122-
Now, use the `Start-AzDataProtectionBackupInstanceRestore` cmdlet to trigger the restore operation with the request prepared earlier.
128+
- *Target AKS* cluster should have *Contributor* role on the *Snapshot Resource Group*.
129+
- The *User Identity* attached with the Backup Extension should have *Storage Account Contributor* roles on the *storage account* where backups are stored.
130+
- The *Backup vault* should have a *Reader* role on the *Target AKS cluster* and *Snapshot Resource Group*.
123131
124-
```azurepowershell
125-
$restoreJob = Start-AzDataProtectionBackupInstanceRestore -SubscriptionId $vaultSubId -ResourceGroupName $vaultRgName -VaultName $vaultName -BackupInstanceName $AllInstances[2].BackupInstanceName -Parameter $aksRestoreRequest
126-
```
132+
2. To trigger the restore operation with the request prepared earlier by using the `Start-AzDataProtectionBackupInstanceRestore` cmdlet.
133+
134+
```azurepowershell
135+
$restoreJob = Start-AzDataProtectionBackupInstanceRestore -SubscriptionId $vaultSubId -ResourceGroupName $vaultRgName -VaultName $vaultName -BackupInstanceName $AllInstances[2].BackupInstanceName -Parameter $aksRestoreRequest
136+
```
127137
128-
## Tracking job
138+
## Track the restore job
129139
130-
Track all the jobs using the `Get-AzDataProtectionJob` cmdlet. You can list all jobs and fetch a particular job detail. You can also use `Az.ResourceGraph` to track all jobs across all Backup vaults.
140+
Track all the jobs using the `Get-AzDataProtectionJob` cmdlet. You can list all jobs and fetch a particular job detail. Alternatively, use Az.ResourceGraph to track jobs across all Backup vaults.
131141
132-
Use the `Search-AzDataProtectionJobInAzGraph` cmdlet to get the relevant job, which can be across any Backup vault.
142+
To get the relevant job across any Backup vault, use the `Search-AzDataProtectionJobInAzGraph` cmdlet.
133143
134144
```azurepowershell
135145
$job = Search-AzDataProtectionJobInAzGraph -Subscription -SubscriptionId $vaultSubId -ResourceGroup $vaultRgName -Vault $vaultName -DatasourceType AzureKubernetesService -Operation Restore
136146
```
137147

138148
## Next steps
139149

140-
- [Manage Azure Kubernetes Service cluster backups](azure-kubernetes-service-cluster-manage-backups.md)
141-
- [About Azure Kubernetes Service cluster backup](azure-kubernetes-service-cluster-backup-concept.md)
150+
- [Management of Azure Kubernetes Service cluster backups](azure-kubernetes-service-cluster-manage-backups.md).
151+
- [Azure Kubernetes Service cluster backup overview](azure-kubernetes-service-cluster-backup-concept.md).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ms.service: azure-backup
66
ms.custom:
77
- ignite-2023
88
- ignite-2024
9-
ms.date: 11/19/2024
9+
ms.date: 01/30/2025
1010
author: jyothisuri
1111
ms.author: jsuri
1212
---
1313

1414
# Restore Azure Kubernetes Service using Azure Backup
1515

16-
This article describes how to restore backed-up Azure Kubernetes Service (AKS).
16+
This article describes how to restore backed-up Azure Kubernetes Service (AKS). You can also restore AKS cluster using [Azure PowerShell](azure-kubernetes-service-cluster-restore-using-powershell.md).
1717

1818
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.
1919

0 commit comments

Comments
 (0)