Skip to content

Commit 7c8b7ec

Browse files
Merge pull request #291646 from AbhishekMallick-MS/Dec-9-2024-AFS
AFS Multiple backup policy
2 parents 2bc1675 + 28d5645 commit 7c8b7ec

File tree

1 file changed

+15
-41
lines changed

1 file changed

+15
-41
lines changed

articles/backup/backup-azure-afs-automation.md

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Back up an Azure file share by using PowerShell
33
description: In this article, learn how to back up an Azure Files file share by using the Azure Backup service and PowerShell.
44
ms.topic: how-to
5-
ms.date: 07/18/2024
5+
ms.date: 12/10/2024
66
ms.custom: devx-track-azurepowershell
77
ms.service: azure-backup
88
author: AbhishekMallick-MS
@@ -152,45 +152,12 @@ A backup policy specifies the schedule for backups, and how long backup recovery
152152

153153
A backup policy is associated with at least one retention policy. A retention policy defines how long a recovery point is kept before it's deleted. You can configure backups with daily, weekly, monthly, or yearly retention. With multiple backups policy, you can also configure backups hourly retention.
154154

155-
**Choose a policy type**:
156-
157-
# [Daily backup policy](#tab/daily-backup-policy)
158-
159-
Here are some cmdlets for backup policies:
160-
161-
* View the default backup policy retention by using [Get-AzRecoveryServicesBackupRetentionPolicyObject](/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupretentionpolicyobject).
162-
* View the default backup policy schedule by using [Get-AzRecoveryServicesBackupSchedulePolicyObject](/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupschedulepolicyobject).
163-
* Create a new backup policy by using [New-AzRecoveryServicesBackupProtectionPolicy](/powershell/module/az.recoveryservices/set-azrecoveryservicesbackupprotectionpolicy). You enter the schedule and retention policy objects as input.
164-
165-
By default, a start time is defined in the schedule policy object. Use the following example to change the start time to the desired start time. The desired start time should be in Universal Coordinated Time (UTC). The example assumes that the desired start time is 01:00 AM UTC for daily backups.
166-
167-
```azurepowershell-interactive
168-
$schPol = Get-AzRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureFiles"
169-
$UtcTime = Get-Date -Date "2019-03-20 01:30:00Z"
170-
$UtcTime = $UtcTime.ToUniversalTime()
171-
$schpol.ScheduleRunTimes[0] = $UtcTime
172-
```
173-
174-
> [!IMPORTANT]
175-
> You need to provide the start time in 30-minute multiples only. In the preceding example, it can be only "01:00:00" or "02:30:00". The start time can't be "01:15:00".
176-
177-
The following example stores the schedule policy and the retention policy in variables. It then uses those variables as parameters for a new policy (**NewAFSPolicy**). **NewAFSPolicy** takes a daily backup and retains it for 30 days.
178-
179-
```azurepowershell-interactive
180-
$schPol = Get-AzRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureFiles"
181-
$retPol = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureFiles"
182-
New-AzRecoveryServicesBackupProtectionPolicy -Name "NewAFSPolicy" -WorkloadType "AzureFiles" -RetentionPolicy $retPol -SchedulePolicy $schPol
183-
```
184-
185-
The output is similar to the following:
186-
187-
```azurepowershell-interactive
188-
Name WorkloadType BackupManagementType BackupTime DaysOfWeek
189-
---- ------------ -------------------- ---------- ----------
190-
NewAFSPolicy AzureFiles AzureStorage 10/24/2019 1:30:00 AM
191-
```
192-
193-
# [Multiple backups policy](#tab/multiple-backups-policy)
155+
>[!Important]
156+
>The following cmdlets are used for the Backup policies:
157+
>
158+
>- View the default backup policy retention by using `Get-AzRecoveryServicesBackupRetentionPolicyObject`.
159+
>- View the default backup policy schedule by using `Get-AzRecoveryServicesBackupSchedulePolicyObject`.
160+
>- Create a new backup policy by using `New-AzRecoveryServicesBackupProtectionPolicy`. Provide the schedule and retention policy objects as inputs.
194161
195162
To create a backup policy that configures multiple backups a day, follow these steps:
196163

@@ -230,6 +197,14 @@ To create a backup policy that configures multiple backups a day, follow these s
230197
$schPol.ScheduleRunTimeZone=$timeZone.Id
231198
```
232199

200+
To reate a policy with daily schedule, run the following cmdlet:
201+
202+
```azurepowershell
203+
$UtcTime = Get-Date -Date "2019-03-20 01:30:00Z"
204+
$UtcTime = $UtcTime.ToUniversalTime()
205+
$schpol.ScheduleRunTimes[0] = $UtcTime
206+
```
207+
233208
1. Fetch the retention policy object using following cmdlet:
234209

235210
```azurepowershell-interactive
@@ -260,7 +235,6 @@ To create a backup policy that configures multiple backups a day, follow these s
260235
testing AzureFiles AzureStorage Hourly 12/22/2021 8:00:00 AM 4 12 Russia Time Zone 11
261236
262237
```
263-
---
264238
265239
## Enable backup
266240

0 commit comments

Comments
 (0)