File tree Expand file tree Collapse file tree 7 files changed +266
-239
lines changed
RecoveryServices.Backup.Helpers/Conversions
RecoveryServices.Backup.Models/AzureVmModels
RecoveryServices.Backup.Providers/Providers
RecoveryServices.Backup.Test
SessionRecords/Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.PolicyTests Expand file tree Collapse file tree 7 files changed +266
-239
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,10 @@ public static PolicyBase GetPolicyModelForAzureIaaSVM(ServiceClientModel.Protect
170
170
iaasPolicyModel . SchedulePolicy = PolicyHelpers . GetPSSimpleSchedulePolicy ( ( ServiceClientModel . SimpleSchedulePolicy )
171
171
( ( ServiceClientModel . AzureIaaSVMProtectionPolicy ) serviceClientResponse . Properties ) . SchedulePolicy ,
172
172
( ( ServiceClientModel . AzureIaaSVMProtectionPolicy ) serviceClientResponse . Properties ) . TimeZone ) ;
173
+ iaasPolicyModel . AzureBackupRGName =
174
+ ( ( ServiceClientModel . AzureIaaSVMProtectionPolicy ) serviceClientResponse . Properties ) . InstantRPDetails . AzureBackupRGNamePrefix ;
175
+ iaasPolicyModel . AzureBackupRGNameSuffix =
176
+ ( ( ServiceClientModel . AzureIaaSVMProtectionPolicy ) serviceClientResponse . Properties ) . InstantRPDetails . AzureBackupRGNameSuffix ;
173
177
return policyModel ;
174
178
}
175
179
Original file line number Diff line number Diff line change 12
12
// limitations under the License.
13
13
// ----------------------------------------------------------------------------------
14
14
15
+ using Microsoft . Azure . Commands . Common . Compute . Version_2018_04 . Models ;
16
+
15
17
namespace Microsoft . Azure . Commands . RecoveryServices . Backup . Cmdlets . Models
16
18
{
17
19
/// <summary>
@@ -28,6 +30,16 @@ public class AzureVmPolicy : AzurePolicy
28
30
/// Object defining the number of associated items for the policy
29
31
/// </summary>
30
32
public int ? ProtectedItemsCount { get ; set ; }
33
+
34
+ /// <summary>
35
+ /// object defining the RG Name to store Restore Points
36
+ /// </summary>
37
+ public string AzureBackupRGName { get ; set ; }
38
+
39
+ /// <summary>
40
+ /// object defining the RG Name suffix to store Restore Points
41
+ /// </summary>
42
+ public string AzureBackupRGNameSuffix { get ; set ; }
31
43
}
32
44
33
45
}
Original file line number Diff line number Diff line change @@ -753,7 +753,10 @@ public RestAzureNS.AzureOperationResponse<ProtectionPolicyResource> ModifyPolicy
753
753
SchedulePolicy = PolicyHelpers . GetServiceClientSimpleSchedulePolicy (
754
754
( CmdletModel . SimpleSchedulePolicy ) ( ( AzureVmPolicy ) policy ) . SchedulePolicy ) ,
755
755
TimeZone = DateTimeKind . Utc . ToString ( ) . ToUpper ( ) ,
756
- InstantRpRetentionRangeInDays = ( ( AzureVmPolicy ) policy ) . SnapshotRetentionInDays
756
+ InstantRpRetentionRangeInDays = ( ( AzureVmPolicy ) policy ) . SnapshotRetentionInDays ,
757
+ InstantRPDetails = new InstantRPAdditionalDetails (
758
+ ( ( AzureVmPolicy ) policy ) . AzureBackupRGName ,
759
+ ( ( AzureVmPolicy ) policy ) . AzureBackupRGNameSuffix )
757
760
}
758
761
} ;
759
762
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ $policyName = "PsTestPolicy";
18
18
$defaultPolicyName = " DefaultPolicy" ;
19
19
$DefaultSnapshotDays = 2 ;
20
20
$UpdatedSnapShotDays = 5 ;
21
+ $rgPrefix = " RecoveryServices" ;
22
+ $rgsuffix = " Policy" ;
21
23
22
24
# Test old polices in the VaultId
23
25
$oldResourceGroupName = " sambit_rg"
@@ -78,6 +80,8 @@ function Test-AzureVMPolicy
78
80
79
81
# update snapshot days
80
82
$policy.SnapshotRetentionInDays = $UpdatedSnapShotDays ;
83
+ $policy.AzureBackupRGName = $rgPrefix ;
84
+ $policy.AzureBackupRGNameSuffix = $rgsuffix ;
81
85
82
86
# Update policy
83
87
Set-AzRecoveryServicesBackupProtectionPolicy `
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 23
23
* Azure Backup added support for retrying policy update for failed items.
24
24
* Azure Backup Added support for disk exclusion settings during backup and restore.
25
25
* Azure Backup Added Support for Restoring Multiple files/folders in AzureFileShare
26
+ * Azure Backup Added support for User-specified Resourcegroup support while updating IaasVM Policy
26
27
27
28
## Version 2.7.0
28
29
* Added Support for Restore-as-files for SQL Databases.
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ PS C:\> $SchPol.ScheduleRunTimes.Add($DT.ToUniversalTime())
43
43
PS C:\> $RetPol = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
44
44
PS C:\> $RetPol.DailySchedule.DurationCountInDays = 365
45
45
PS C:\> $Pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "NewPolicy"
46
+ PS C:\> $Pol.AzureBackupRGName = "RG_prefix"
47
+ PS C:\> $Pol.AzureBackupRGNameSuffix = "RG_suffix"
46
48
PS C:\> Set-AzRecoveryServicesBackupProtectionPolicy -Policy $Pol -SchedulePolicy $SchPol -RetentionPolicy $RetPol
47
49
```
48
50
@@ -53,6 +55,7 @@ The fourth command adds the date and time in $DT to the schedule run time for th
53
55
The fifth command gets a base retention policy object, and then stores it in the $RetPol variable.
54
56
The sixth command sets the retention duration to 365 days.
55
57
The seventh command gets the Backup protection policy named NewPolicy, and then stores it in the $Pol variable.
58
+ The eighth and ninth sets the resource group parameters associated with policy which stores the restore points.
56
59
The final command modifies the Backup protection policy in $Pol using schedule policy in $SchPol and the retention policy in $RetPol.
57
60
58
61
## PARAMETERS
You can’t perform that action at this time.
0 commit comments