You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/backup/backup-azure-afs-automation.md
+4-148Lines changed: 4 additions & 148 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
-
title: Back up and restore Azure Files with PowerShell
3
-
description: In this article, learn how to back up and restore Azure Files using the Azure Backup service and PowerShell.
2
+
title: Back up Azure Files with PowerShell
3
+
description: In this article, learn how to back up Azure Files using the Azure Backup service and PowerShell.
4
4
ms.topic: conceptual
5
5
ms.date: 08/20/2019
6
6
---
7
7
8
-
# Back up and restore Azure Files with PowerShell
8
+
# Back up Azure Files with PowerShell
9
9
10
-
This article describes how to use Azure PowerShell to back up and recover an Azure Files file share using an [Azure Backup](backup-overview.md) Recovery Services vault.
10
+
This article describes how to use Azure PowerShell to back up an Azure Files file share using an [Azure Backup](backup-overview.md) Recovery Services vault.
11
11
12
12
This article explains how to:
13
13
@@ -17,8 +17,6 @@ This article explains how to:
17
17
> * Create a Recovery Services vault.
18
18
> * Configure backup for an Azure file share.
19
19
> * Run a backup job.
20
-
> * Restore a backed up Azure file share, or an individual file from a share.
21
-
> * Monitor backup and restore jobs.
22
20
23
21
## Before you start
24
22
@@ -270,148 +268,6 @@ On-demand backups can be used to retain your snapshots for 10 years. Schedulers
270
268
271
269
If you are looking for sample scripts, you can refer to the sample script on GitHub (<https://github.com/Azure-Samples/Use-PowerShell-for-long-term-retention-of-Azure-Files-Backup>) using Azure Automation runbook that enables you to schedule backups on a periodic basis and retain them even up to 10 years.
272
270
273
-
### Modify the protection policy
274
-
275
-
To change the policy used for backing up the Azure file share, use [Enable-AzRecoveryServicesBackupProtection](https://docs.microsoft.com/powershell/module/az.recoveryservices/enable-azrecoveryservicesbackupprotection?view=azps-1.4.0). Specify the relevant backup item and the new backup policy.
276
-
277
-
The following example changes the **testAzureFS** protection policy from **dailyafs** to **monthlyafs**.
You can restore an entire file share or specific files on the share. You can restore to the original location, or to an alternate location.
289
-
290
-
### Fetch recovery points
291
-
292
-
Use [Get-AzRecoveryServicesBackupRecoveryPoint](https://docs.microsoft.com/powershell/module/az.recoveryservices/get-azrecoveryservicesbackuprecoverypoint?view=azps-1.4.0) to list all recovery points for the backed-up item.
293
-
294
-
In the following script:
295
-
296
-
* The variable **$rp** is an array of recovery points for the selected backup item from the past seven days.
297
-
* The array is sorted in reverse order of time with the latest recovery point at index **0**.
298
-
* Use standard PowerShell array indexing to pick the recovery point.
299
-
* In the example, **$rp[0]** selects the latest recovery point.
Id : /Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Micros oft.RecoveryServices/vaults/testVault/backupFabrics/Azure/protectionContainers/StorageContainer;storage;teststorageRG;testStorageAcct/protectedItems/AzureFileShare;testAzureFS/recoveryPoints/86593702401462
After the relevant recovery point is selected, you restore the file share or file to the original location, or to an alternate location.
326
-
327
-
### Restore an Azure file share to an alternate location
328
-
329
-
Use the [Restore-AzRecoveryServicesBackupItem](https://docs.microsoft.com/powershell/module/az.recoveryservices/restore-azrecoveryservicesbackupitem?view=azps-1.4.0) to restore to the selected recovery point. Specify these parameters to identify the alternate location:
330
-
331
-
***TargetStorageAccountName**: The storage account to which the backed-up content is restored. The target storage account must be in the same location as the vault.
332
-
***TargetFileShareName**: The file shares within the target storage account to which the backed-up content is restored.
333
-
***TargetFolder**: The folder under the file share to which data is restored. If the backed-up content is to be restored to a root folder, give the target folder values as an empty string.
334
-
***ResolveConflict**: Instruction if there's a conflict with the restored data. Accepts **Overwrite** or **Skip**.
testAzureFS Restore InProgress 12/10/2018 9:56:38 AM 9fd34525-6c46-496e-980a-3740ccb2ad75
348
-
```
349
-
350
-
### Restore an Azure file to an alternate location
351
-
352
-
Use the [Restore-AzRecoveryServicesBackupItem](https://docs.microsoft.com/powershell/module/az.recoveryservices/restore-azrecoveryservicesbackupitem?view=azps-1.4.0) to restore to the selected recovery point. Specify these parameters to identify the alternate location, and to uniquely identify the file you want to restore.
353
-
354
-
***TargetStorageAccountName**: The storage account to which the backed-up content is restored. The target storage account must be in the same location as the vault.
355
-
***TargetFileShareName**: The file shares within the target storage account to which the backed-up content is restored.
356
-
***TargetFolder**: The folder under the file share to which data is restored. If the backed-up content is to be restored to a root folder, give the target folder values as an empty string.
357
-
***SourceFilePath**: The absolute path of the file, to be restored within the file share, as a string. This path is the same path used in the **Get-AzStorageFile** PowerShell cmdlet.
358
-
***SourceFileType**: Whether a directory or a file is selected. Accepts **Directory** or **File**.
359
-
***ResolveConflict**: Instruction if there's a conflict with the restored data. Accepts **Overwrite** or **Skip**.
360
-
361
-
The additional parameters (SourceFilePath and SourceFileType) are related only to the individual file you want to restore.
This command returns a job with an ID to be tracked, as shown in the previous section.
368
-
369
-
### Restore Azure file shares and files to the original location
370
-
371
-
When you restore to an original location, you don't need to specify destination- and target-related parameters. Only **ResolveConflict** must be provided.
On-demand backup and restore operations return a job along with an ID, as shown when you [ran an on-demand backup](#trigger-an-on-demand-backup). Use the [Get-AzRecoveryServicesBackupJobDetails](https://docs.microsoft.com/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupjob?view=azps-1.4.0) cmdlet to track the job progress and details.
1073871825 Microsoft Azure Backup encountered an internal error. Wait for a few minutes and then try the operation again. If the issue persists, please contact Microsoft support.
413
-
```
414
-
415
271
## Next steps
416
272
417
273
[Learn about](backup-afs.md) backing up Azure Files in the Azure portal.
title: Manage Azure file share backups with PowerShell
3
+
description: Learn how to use PowerShell to manage and monitor Azure file shares backed up by the Azure Backup service.
4
+
ms.topic: conceptual
5
+
ms.date: 1/27/2020
6
+
---
7
+
8
+
# Manage Azure file share backups with PowerShell
9
+
10
+
This article describes how to use Azure PowerShell to manage and monitor the Azure file shares that are backed up by the Azure Backup service.
11
+
12
+
## Modify the protection policy
13
+
14
+
To change the policy used for backing up the Azure file share, use [Enable-AzRecoveryServicesBackupProtection](https://docs.microsoft.com/powershell/module/az.recoveryservices/enable-azrecoveryservicesbackupprotection?view=azps-1.4.0). Specify the relevant backup item and the new backup policy.
15
+
16
+
The following example changes the **testAzureFS** protection policy from **dailyafs** to **monthlyafs**.
On-demand backup and restore operations return a job along with an ID, as shown when you [run an on-demand backup](backup-azure-afs-automation.md#trigger-an-on-demand-backup). Use the [Get-AzRecoveryServicesBackupJobDetails](https://docs.microsoft.com/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupjob?view=azps-1.4.0) cmdlet to track the job progress and details.
1073871825 Microsoft Azure Backup encountered an internal error. Wait for a few minutes and then try the operation again. If the issue persists, please contact Microsoft support.
53
+
```
54
+
55
+
## Stop protection on a file share
56
+
57
+
There are two ways to stop protecting Azure file shares:
58
+
59
+
* Stop all future backup jobs and *delete* all recovery points
60
+
* Stop all future backup jobs but *leave* the recovery points
61
+
62
+
There may be a cost associated with leaving the recovery points in storage, as the underlying snapshots created by Azure Backup will be retained. However, the benefit of leaving the recovery points is you can restore the file share later, if desired. For information about the cost of leaving the recovery points, see the [pricing details](https://azure.microsoft.com/pricing/details/storage/files/). If you choose to delete all recovery points, you can't restore the file share.
63
+
64
+
## Stop protection and retain recovery points
65
+
66
+
To stop protection while retaining data, use the [Disable-AzRecoveryServicesBackupProtection](https://docs.microsoft.com/powershell/module/az.recoveryservices/disable-azrecoveryservicesbackupprotection?view=azps-3.3.0) cmdlet.
67
+
68
+
The following example stops protection for the *afsfileshare* file share but retains all recovery points:
The Job ID attribute in the output corresponds to the Job ID of the job that is created by the backup service for your “stop protection” operation. To track the status of the job, use the [Get-AzRecoveryServicesBackupJob](https://docs.microsoft.com/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupjob?view=azps-3.3.0) cmdlet.
83
+
84
+
## Stop protection without retaining recovery points
85
+
86
+
To stop protection without retaining recovery points, use the [Disable-AzRecoveryServicesBackupProtection](https://docs.microsoft.com/powershell/module/az.recoveryservices/disable-azrecoveryservicesbackupprotection?view=azps-3.3.0) cmdlet and add the **-RemoveRecoveryPoints** parameter.
87
+
88
+
The following example stops protection for the *afsfileshare* file share without retaining recovery points:
0 commit comments