Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ public static PolicyBase GetPolicyModelForAzureIaaSVM(ServiceClientModel.Protect
iaasPolicyModel.SchedulePolicy = PolicyHelpers.GetPSSimpleSchedulePolicy((ServiceClientModel.SimpleSchedulePolicy)
((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).SchedulePolicy,
((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).TimeZone);
iaasPolicyModel.AzureBackupRGName =
((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).InstantRPDetails.AzureBackupRGNamePrefix;
iaasPolicyModel.AzureBackupRGNameSuffix =
((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).InstantRPDetails.AzureBackupRGNameSuffix;
return policyModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Common.Compute.Version_2018_04.Models;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
{
/// <summary>
Expand All @@ -28,6 +30,16 @@ public class AzureVmPolicy : AzurePolicy
/// Object defining the number of associated items for the policy
/// </summary>
public int? ProtectedItemsCount { get; set; }

/// <summary>
/// object defining the RG Name to store Restore Points
/// </summary>
public string AzureBackupRGName { get; set; }

/// <summary>
/// object defining the RG Name suffix to store Restore Points
/// </summary>
public string AzureBackupRGNameSuffix { get; set; }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,10 @@ public RestAzureNS.AzureOperationResponse<ProtectionPolicyResource> ModifyPolicy
SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy(
(CmdletModel.SimpleSchedulePolicy)((AzureVmPolicy)policy).SchedulePolicy),
TimeZone = DateTimeKind.Utc.ToString().ToUpper(),
InstantRpRetentionRangeInDays = ((AzureVmPolicy)policy).SnapshotRetentionInDays
InstantRpRetentionRangeInDays = ((AzureVmPolicy)policy).SnapshotRetentionInDays,
InstantRPDetails = new InstantRPAdditionalDetails(
((AzureVmPolicy)policy).AzureBackupRGName,
((AzureVmPolicy)policy).AzureBackupRGNameSuffix)
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ $policyName = "PsTestPolicy";
$defaultPolicyName = "DefaultPolicy";
$DefaultSnapshotDays = 2;
$UpdatedSnapShotDays = 5;
$rgPrefix = "RecoveryServices";
$rgsuffix = "Policy";

# Test old polices in the VaultId
$oldResourceGroupName = "sambit_rg"
Expand Down Expand Up @@ -78,6 +80,8 @@ function Test-AzureVMPolicy

#update snapshot days
$policy.SnapshotRetentionInDays = $UpdatedSnapShotDays;
$policy.AzureBackupRGName = $rgPrefix;
$policy.AzureBackupRGNameSuffix = $rgsuffix;

# Update policy
Set-AzRecoveryServicesBackupProtectionPolicy `
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/RecoveryServices/RecoveryServices/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Azure Backup added support for retrying policy update for failed items.
* Azure Backup Added support for disk exclusion settings during backup and restore.
* Azure Backup Added Support for Restoring Multiple files/folders in AzureFileShare
* Azure Backup Added support for User-specified Resourcegroup support while updating IaasVM Policy

## Version 2.7.0
* Added Support for Restore-as-files for SQL Databases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ PS C:\> $SchPol.ScheduleRunTimes.Add($DT.ToUniversalTime())
PS C:\> $RetPol = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
PS C:\> $RetPol.DailySchedule.DurationCountInDays = 365
PS C:\> $Pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "NewPolicy"
PS C:\> $Pol.AzureBackupRGName = "RG_prefix"
PS C:\> $Pol.AzureBackupRGNameSuffix = "RG_suffix"
PS C:\> Set-AzRecoveryServicesBackupProtectionPolicy -Policy $Pol -SchedulePolicy $SchPol -RetentionPolicy $RetPol
```

Expand All @@ -53,6 +55,7 @@ The fourth command adds the date and time in $DT to the schedule run time for th
The fifth command gets a base retention policy object, and then stores it in the $RetPol variable.
The sixth command sets the retention duration to 365 days.
The seventh command gets the Backup protection policy named NewPolicy, and then stores it in the $Pol variable.
The eighth and ninth sets the resource group parameters associated with policy which stores the restore points.
The final command modifies the Backup protection policy in $Pol using schedule policy in $SchPol and the retention policy in $RetPol.

## PARAMETERS
Expand Down