Skip to content

Honoring UseManagedDisk input for HyperV to Azure scenario in site recovery service #14131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2021
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 @@ -204,5 +204,22 @@ public void TestUpdateRPIWithAvZone()
this.VaultSettingsFilePath +
"\"");
}

[Fact]
[Trait(
Category.AcceptanceType,
Category.CheckIn)]
public void TestCreateRPIWithManagedDisk()
{
this.VaultSettingsFilePath = System.IO.Path.Combine(
System.AppDomain.CurrentDomain.BaseDirectory,
"ScenarioTests", "B2A", "B2AInput", "B2A.VaultCredentials");
this.RunPowerShellTest(
_logger,
Constants.NewModel,
"Test-CreateRPIWithManagedDisk -vaultSettingsFilePath \"" +
this.VaultSettingsFilePath +
"\"");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -890,4 +890,24 @@ function Test-UpdateRPIWithAvailabilityZone
Set-AsrReplicationProtectedItem -InputObject $rpi -RecoveryAvailabilityZone $avZoneSet
$rpi = Get-AsrReplicationProtectedItem -ProtectionContainer $pc -FriendlyName $VMFriendlyName
Assert-NotNull($rpi.ProviderSpecificDetails.RecoveryAvailabilityZone)
}

function Test-CreateRPIWithManagedDisk
{
param([string] $vaultSettingsFilePath)

# Import Azure RecoveryServices Vault Settings File
Import-AzRecoveryServicesAsrVaultSettingsFile -Path $vaultSettingsFilePath
$PrimaryFabricName = "H2ASite"
$fabric = Get-AsrFabric -FriendlyName $PrimaryFabricName
$pc = Get-ASRProtectionContainer -Fabric $fabric
$pcm = Get-ASRProtectionContainerMapping -ProtectionContainer $pc
$policyName ="b2apolicy"
$policy = Get-AzRecoveryServicesAsrPolicy -Name $policyName
$VMFriendlyName ="NestedDum1"
$VM= Get-AsrProtectableItem -ProtectionContainer $pc -FriendlyName $VMFriendlyName
$ResourceGroupId ="/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/h2arg"
$LogStorageAccountId = "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/h2arg/providers/Microsoft.Storage/storageAccounts/hrasa"
$ppg = "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/h2arg/providers/Microsoft.Compute/proximityPlacementGroups/ppgh2a"
$EnableDRjob = New-AsrReplicationProtectedItem -ProtectableItem $VM -Name $VM.Name -ProtectionContainerMapping $pcm -RecoveryAzureStorageAccountId $LogStorageAccountId -OSDiskName $($VMFriendlyName+"disk") -OS Windows -RecoveryResourceGroupId $ResourceGroupId -RecoveryProximityPlacementGroupId $ppg -UseManagedDisk true
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,17 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
[ValidateNotNullOrEmpty]
public string RecoveryAvailabilitySetId { get; set; }

/// <summary>
/// Gets or sets if the Azure virtual machine that is created on failover should use managed disks.
/// </summary>
[Parameter]
[ValidateNotNullOrEmpty]
[ValidateSet(
Constants.True,
Constants.False)]
[Parameter(ParameterSetName = ASRParameterSets.HyperVSiteToAzure)]
public string UseManagedDisk { get; set; }

/// <summary>
/// Gets or sets BootDiagnosticStorageAccountId.
/// </summary>
Expand Down Expand Up @@ -592,6 +603,7 @@ private void EnterpriseAndHyperVToAzure(EnableProtectionInput input)
: this.RecoveryVmName;
providerSettings.TargetProximityPlacementGroupId = this.RecoveryProximityPlacementGroupId;
providerSettings.TargetAvailabilityZone = this.RecoveryAvailabilityZone;
providerSettings.UseManagedDisks = this.UseManagedDisk;

if (!string.IsNullOrEmpty(this.RecoveryAzureNetworkId))
{
Expand Down
1 change: 1 addition & 0 deletions src/RecoveryServices/RecoveryServices/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Added Zone Redundancy for Recovery Service Vaults.
* Azure Site Recovery support for Proximity placement group for VMware to Azure and HyperV to Azure providers.
* Azure Site Recovery support for Availability zone for VMware to Azure and HyperV to Azure providers.
* Azure Site Recovery support for UseManagedDisk for HyperV to Azure provider

## Version 3.3.0
* Added Cross Region Restore feature.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ New-AzRecoveryServicesAsrReplicationProtectedItem [-HyperVToAzure] -ProtectableI
-RecoveryAzureStorageAccountId <String> -OSDiskName <String> -OS <String> [-LogStorageAccountId <String>]
[-IncludeDiskId <String[]>] [-RecoveryAzureNetworkId <String>] [-RecoveryAzureSubnetName <String>]
-RecoveryResourceGroupId <String> [-RecoveryAvailabilityZone <String>]
[-RecoveryProximityPlacementGroupId <String>] [-WaitForCompletion] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
[-RecoveryProximityPlacementGroupId <String>] [-UseManagedDisk <String>] [-WaitForCompletion]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### AzureToAzure
Expand Down Expand Up @@ -685,6 +685,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -UseManagedDisk
Specifies if the Azure virtual machine that is created on failover should use managed disks. It Accepts either True or False.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: True, False

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -VmmToVmm
Switch parameter to specify the replicated item is a Hyper-V virtual machine that is being replicated between VMM managed Hyper-V sites.

Expand Down