Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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 @@ -116,6 +116,7 @@ CmdletsToExport =
'Remove-AzureRmRecoveryServicesAsrProtectionContainerMapping',
'Remove-AzureRmRecoveryServicesAsrRecoveryPlan',
'Remove-AzureRmRecoveryServicesAsrReplicationProtectedItem',
'Remove-AzureRmRecoveryServicesAsrReplicationProtectedItemDisk',
'Remove-AzureRmRecoveryServicesAsrServicesProvider',
'Remove-AzureRmRecoveryServicesAsrStorageClassificationMapping',
'Remove-AzureRmRecoveryServicesAsrvCenter',
Expand Down Expand Up @@ -162,8 +163,9 @@ AliasesToExport = 'Add-ASRReplicationProtectedItemDisk', 'Edit-ASRRP', 'Edit-ASR
'New-ASRRecoveryPlan', 'New-ASRReplicationProtectedItem',
'New-ASRStorageClassificationMapping', 'New-ASRvCenter',
'Remove-ASRFabric', 'Remove-ASRNetworkMapping', 'Remove-ASRPolicy',
'Remove-ASRProtectionContainerMapping', 'Remove-ASRRP',
'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
'Remove-ASRProtectionContainerMapping', 'Remove-ASRRP',
'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
'Remove-ASRReplicationProtectedItemDisk',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&nit;

'Remove-ASRServicesProvider',
'Remove-ASRStorageClassificationMapping', 'Remove-ASRvCenter',
'Restart-ASRJob', 'Resume-ASRJob', 'Set-ASRAlertSetting',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.4.2.1-preview\lib\net452\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.RecoveryServices.SiteRecovery, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.SiteRecovery.1.3.0-preview\lib\net452\Microsoft.Azure.Management.RecoveryServices.SiteRecovery.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.RecoveryServices.SiteRecovery, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.SiteRecovery.2.0.0-preview\lib\net452\Microsoft.Azure.Management.RecoveryServices.SiteRecovery.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.18\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.19\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.18\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.19\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -118,6 +118,7 @@
<Compile Include="RecoveryPlan\EditAzureRmRecoveryServicesAsrRecoveryPlan.cs" />
<Compile Include="RecoveryPlan\NewAzureRmRecoveryServicesAsrRecoveryPlan.cs" />
<Compile Include="RecoveryPoint\GetAzureRmRecoveryServicesAsrRecoveryPoint.cs" />
<Compile Include="ReplicationProtectedItem\RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemDisk.cs" />
<Compile Include="ReplicationProtectedItem\GetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs" />
<Compile Include="ReplicationProtectedItem\AddAzureRmRecoveryServicesAsrReplicationProtectedItemDisk.cs" />
<Compile Include="ReplicationProtectedItem\NewAzureRmRecoveryServicesAsrReplicationProtectedItem.cs" />
Expand Down Expand Up @@ -196,4 +197,4 @@
</ItemGroup>
<Copy SourceFiles="@(MarkdownFiles)" DestinationFolder="$(OutputPath)\help\" ContinueOnError="false" />
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public partial class PSRecoveryServicesClient
/// Removes Replicated Protected Item.
/// </summary>
/// <param name="fabricName">Fabric Name</param>
/// <param name="protectionContainerName">Protection Container ID</param>
/// <param name="replicationProtectedItemName">Virtual Machine ID or Replication group Id</param>
/// <param name="protectionContainerName">Protection Container Name</param>
/// <param name="replicationProtectedItemName">Replication Protected Item Name</param>
/// <param name="input">Disable protection input.</param>
/// <returns>Job response</returns>
public PSSiteRecoveryLongRunningOperation DisableProtection(
Expand All @@ -56,8 +56,8 @@ public PSSiteRecoveryLongRunningOperation DisableProtection(
/// Creates Replicated Protected Item.
/// </summary>
/// <param name="fabricName">Fabric Name</param>
/// <param name="protectionContainerName">Protection Container ID</param>
/// <param name="replicationProtectedItemName">Virtual Machine ID or Replication group Id</param>
/// <param name="protectionContainerName">Protection Container Name</param>
/// <param name="replicationProtectedItemName">Replication Protected Item Name</param>
/// <param name="input">Enable protection input.</param>
/// <returns>Job response</returns>
public PSSiteRecoveryLongRunningOperation EnableProtection(
Expand All @@ -81,11 +81,11 @@ public PSSiteRecoveryLongRunningOperation EnableProtection(
}

/// <summary>
/// Add disks to replicated protected item.
/// Add disks to replication protected item.
/// </summary>
/// <param name="fabricName">Fabric Name</param>
/// <param name="protectionContainerName">Protection Container ID</param>
/// <param name="replicationProtectedItemName">Virtual Machine ID or Replication group Id</param>
/// <param name="protectionContainerName">Protection Container Name</param>
/// <param name="replicationProtectedItemName">Replication Protected Item Name</param>
/// <param name="input">Add disks input.</param>
/// <returns>Job response</returns>
public PSSiteRecoveryLongRunningOperation AddDisks(
Expand All @@ -108,6 +108,34 @@ public PSSiteRecoveryLongRunningOperation AddDisks(
return result;
}

/// <summary>
/// Remove disks from replication protected item.
/// </summary>
/// <param name="fabricName">Fabric Name</param>
/// <param name="protectionContainerName">Protection Container Name</param>
/// <param name="replicationProtectedItemName">Replication Protected Item Name</param>
/// <param name="input">Remove disks input.</param>
/// <returns>Job response</returns>
public PSSiteRecoveryLongRunningOperation RemoveDisks(
string fabricName,
string protectionContainerName,
string replicationProtectedItemName,
RemoveDisksInput input)
{
var op = this.GetSiteRecoveryClient()
.ReplicationProtectedItems.BeginRemoveDisksWithHttpMessagesAsync(
fabricName,
protectionContainerName,
replicationProtectedItemName,
input,
this.GetRequestHeaders(true))
.GetAwaiter()
.GetResult();

var result = SiteRecoveryAutoMapperProfile.Mapper.Map<PSSiteRecoveryLongRunningOperation>(op);
return result;
}

/// <summary>
/// Retrieves Replicated Protected Item.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ public ASRAzureToAzureSpecificRPIDetails(A2AReplicationDetails details)
this.RecoveryAzureCloudService = details.RecoveryCloudService;
this.RecoveryFabricLocation = details.RecoveryFabricLocation;
this.RecoveryAvailabilitySet = details.RecoveryAvailabilitySet;
this.RecoveryAvailabilityZone = details.RecoveryAvailabilityZone;
this.TestFailoverRecoveryFabricObjectId = details.TestFailoverRecoveryFabricObjectId;
this.MonitoringJobType = details.MonitoringJobType;
this.MonitoringPercentageCompletion = details.MonitoringPercentageCompletion;
Expand Down Expand Up @@ -1214,7 +1215,7 @@ public ASRAzureToAzureSpecificRPIDetails(A2AReplicationDetails details)
.ConvertAll(disk => new ASRAzureToAzureProtectedDiskDetails(disk)));
}

if (details.UnprotectedDisks != null && details.UnprotectedDisks.Count > 0)
/* if (details.UnprotectedDisks != null && details.UnprotectedDisks.Count > 0)
{
this.A2AUnprotectedDiskDetails = new List<A2AUnprotectedDiskDetails>();
foreach (var unprotectedDisk in details.UnprotectedDisks)
Expand All @@ -1226,6 +1227,7 @@ public ASRAzureToAzureSpecificRPIDetails(A2AReplicationDetails details)
});
}
}
*/

if (details.VmSyncedConfigDetails != null)
{
Expand Down Expand Up @@ -1281,6 +1283,11 @@ public ASRAzureToAzureSpecificRPIDetails(A2AReplicationDetails details)
/// </summary>
public string RecoveryAvailabilitySet { get; set; }

/// <summary>
/// Recovery availability zone.
/// </summary>
public string RecoveryAvailabilityZone { get; set; }

/// <summary>
/// Synced configuration details of the virtual machine.
/// </summary>
Expand Down Expand Up @@ -1311,7 +1318,7 @@ public ASRAzureToAzureSpecificRPIDetails(A2AReplicationDetails details)
/// <summary>
/// Gets or sets A2A unprotected disk details.
/// </summary>
public List<A2AUnprotectedDiskDetails> A2AUnprotectedDiskDetails { get; set; }
//public List<A2AUnprotectedDiskDetails> A2AUnprotectedDiskDetails { get; set; }

/// <summary>
/// Gets or sets the recovery fabric object Id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2261,6 +2261,7 @@ public ASRAzureToAzureProtectedDiskDetails(A2AProtectedDiskDetails disk)
this.DiskName = disk.DiskName;
this.DiskType = disk.DiskType;
this.DiskState = disk.DiskState;
this.AllowedDiskLevelOperation = disk.AllowedDiskLevelOperation;
this.Managed = false;
}

Expand All @@ -2280,6 +2281,7 @@ public ASRAzureToAzureProtectedDiskDetails(A2AProtectedManagedDiskDetails disk)
this.DiskName = disk.DiskName;
this.DiskType = disk.DiskType;
this.DiskState = disk.DiskState;
this.AllowedDiskLevelOperation = disk.AllowedDiskLevelOperation;
this.RecoveryReplicaDiskAccountType = disk.RecoveryReplicaDiskAccountType;
this.RecoveryReplicaDiskId = disk.RecoveryReplicaDiskId;
this.RecoveryResourceGroupId = disk.RecoveryResourceGroupId;
Expand Down Expand Up @@ -2360,6 +2362,11 @@ public ASRAzureToAzureProtectedDiskDetails(A2AProtectedManagedDiskDetails disk)
/// </summary>
public string DiskState { get; set; }

/// <summary>
/// Gets or sets the Allowed Disk Level Operation.
/// </summary>
public IList<string> AllowedDiskLevelOperation { get; set; }

/// <summary>
/// Gets or sets recovery disk uri.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
/// </summary>
[Parameter(ParameterSetName = ASRParameterSets.VMwareToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.HyperVSiteToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithoutDiskDetails)]
[ValidateNotNullOrEmpty]
public string RecoveryAzureNetworkId { get; set; }

Expand All @@ -225,6 +227,8 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
/// </summary>
[Parameter(ParameterSetName = ASRParameterSets.VMwareToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.HyperVSiteToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithoutDiskDetails)]
[ValidateNotNullOrEmpty]
public string RecoveryAzureSubnetName { get; set; }

Expand Down Expand Up @@ -261,6 +265,14 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
[ValidateNotNullOrEmpty]
public string RecoveryAvailabilitySetId { get; set; }

/// <summary>
/// Gets or sets ID of the AvailabilityZone to recover the machine to in the event of a failover.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zone is just a number and not an ID.

/// </summary>
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzure)]
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureWithoutDiskDetails)]
[ValidateNotNullOrEmpty]
public string RecoveryAvailabilityZone { get; set; }

/// <summary>
/// Gets or sets BootDiagnosticStorageAccountId.
/// </summary>
Expand Down Expand Up @@ -604,14 +616,23 @@ private void AzureToAzureReplication(EnableProtectionInput input)
RecoveryResourceGroupId = this.RecoveryResourceGroupId,
RecoveryCloudServiceId = this.RecoveryCloudServiceId,
RecoveryAvailabilitySetId = this.RecoveryAvailabilitySetId,
RecoveryBootDiagStorageAccountId = this.RecoveryBootDiagStorageAccountId
RecoveryBootDiagStorageAccountId = this.RecoveryBootDiagStorageAccountId,
RecoveryAvailabilityZone = this.RecoveryAvailabilityZone,
RecoveryAzureNetworkId = this.RecoveryAzureNetworkId,
RecoverySubnetName = this.RecoveryAzureSubnetName
};

if (!string.IsNullOrEmpty(this.RecoveryCloudServiceId))
{
providerSettings.RecoveryResourceGroupId = null;
}

if (!string.IsNullOrEmpty(this.RecoveryAvailabilityZone) &&
!string.IsNullOrEmpty(this.RecoveryAvailabilitySetId))
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use different parameter set instead of having this check.

throw new Exception("RecoveryAvailabilityZone and RecoveryAvailabilitySetId cannot be set together for a VM");
}

if (this.AzureToAzureDiskReplicationConfiguration == null)
{
if (this.AzureVmId.ToLower().Contains(ARMResourceTypeConstants.Compute.ToLower()))
Expand Down
Loading