diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs
index 6e1bfdf78d40..b1067921e3b8 100644
--- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.cs
@@ -32,11 +32,11 @@ public AsrA2ATests(
this.PowershellHelperFile = System.IO.Path.Combine(
System.AppDomain.CurrentDomain.BaseDirectory,
- "ScenarioTests\\A2A\\A2ATestsHelper.ps1");
+ "ScenarioTests", "A2A", "A2ATestsHelper.ps1");
- this.PowershellFile = System.IO.Path.Combine(
+ this.PowershellFile = System.IO.Path.Combine(
System.AppDomain.CurrentDomain.BaseDirectory,
- "ScenarioTests\\A2A\\AsrA2ATests.ps1");
+ "ScenarioTests", "A2A", "AsrA2ATests.ps1");
this.Initialize();
}
@@ -81,5 +81,19 @@ public void A2ANewAsrReplicationProtectedItemDisk()
{
this.RunPowerShellTest(_logger, Constants.NewModel, "Test-AddReplicationProtectedItemDisk");
}
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void A2ARemoveReplicationProtectedItemDisk()
+ {
+ this.RunPowerShellTest(_logger, Constants.NewModel, "Test-RemoveReplicationProtectedItemDisk");
+ }
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void A2ARemoveReplicationProtectedItemHealthError()
+ {
+ this.RunPowerShellTest(_logger, Constants.NewModel, "Test-ResolveHealthError");
+ }
}
}
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1 b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1
index 5a6af300d05e..6fea9cbd9313 100644
--- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1
@@ -376,3 +376,272 @@ function Test-AddReplicationProtectedItemDisk{
$pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
Assert-NotNull($pe)
}
+
+<#
+.SYNOPSIS
+ Test RemoveReplicationProtectedItemDisk new parametersets
+#>
+
+function Test-RemoveReplicationProtectedItemDisk{
+ param([string] $seed ='600')
+ $primaryPolicyName = getPrimaryPolicy
+ $recoveryPolicyName = getRecoveryPolicy
+
+ $primaryContainerMappingName = getPrimaryContainerMapping
+ $recoveryContainerMappingName = getRecoveryContainerMapping
+
+ $primaryContainerName = getPrimaryContainer
+ $recoveryContainerName = getRecoveryContainer
+ $vaultRgLocation = getVaultRgLocation
+ $vaultName = getVaultName
+ $vaultLocation = getVaultLocation
+ $vaultRg = getVaultRg
+ $primaryLocation = getPrimaryLocation
+ $recoveryLocation = getRecoveryLocation
+ $primaryFabricName = getPrimaryFabric
+ $recoveryFabricName = getRecoveryFabric
+ $RecoveryReplicaDiskAccountType = "Premium_LRS"
+ $RecoveryTargetDiskAccountType = "Premium_LRS"
+ $policyName = getPrimaryPolicy
+ $mappingName = getPrimaryContainerMapping
+ $primaryNetMapping = getPrimaryNetworkMapping
+
+ New-AzResourceGroup -name $vaultRg -location $vaultRgLocation -force
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
+ # vault Creation
+ New-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName -Location $vaultLocation
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
+ $Vault = Get-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName
+ Set-ASRVaultContext -Vault $Vault
+ # fabric Creation
+ ### AzureToAzure New paramset
+ $fabJob= New-AzRecoveryServicesAsrFabric -Azure -Name $primaryFabricName -Location $primaryLocation
+ WaitForJobCompletion -JobId $fabJob.Name
+ $fab = Get-AzRecoveryServicesAsrFabric -Name $primaryFabricName
+ Assert-true { $fab.name -eq $primaryFabricName }
+ Assert-AreEqual $fab.FabricSpecificDetails.Location $primaryLocation
+
+ $fabJob= New-AzRecoveryServicesAsrFabric -Azure -Name $recoveryFabricName -Location $recoveryLocation
+ WaitForJobCompletion -JobId $fabJob.Name
+ $fab = Get-AzRecoveryServicesAsrFabric -Name $recoveryFabricName
+ Assert-true { $fab.name -eq $recoveryFabricName }
+ Assert-AreEqual $fab.FabricSpecificDetails.Location $recoveryLocation
+ $pf = get-asrFabric -Name $primaryFabricName
+ $rf = get-asrFabric -Name $recoveryFabricName
+
+ ### AzureToAzure (Default)
+ $job = New-AzRecoveryServicesAsrProtectionContainer -Name $primaryContainerName -Fabric $pf
+ WaitForJobCompletion -JobId $Job.Name
+ $pc = Get-asrProtectionContainer -name $primaryContainerName -Fabric $pf
+ Assert-NotNull($pc)
+ $job = New-AzRecoveryServicesAsrProtectionContainer -Name $recoveryContainerName -Fabric $rf
+ WaitForJobCompletion -JobId $Job.Name
+ $rc = Get-asrProtectionContainer -name $recoveryContainerName -Fabric $rf
+ Assert-NotNull($rc)
+
+ #create policy and mapping
+ $job = New-AzRecoveryServicesAsrPolicy -Name $policyName -RecoveryPointRetentionInHours 12 -AzureToAzure
+ WaitForJobCompletion -JobId $job.Name
+ $policy = Get-AzRecoveryServicesAsrPolicy -Name $policyName
+ $job = New-AzRecoveryServicesAsrProtectionContainerMapping -Name $mappingName -Policy $policy -PrimaryProtectionContainer $pc -RecoveryProtectionContainer $rc
+ WaitForJobCompletion -JobId $job.Name
+ $mapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -Name $mappingName -ProtectionContainer $pc
+
+ $v2VmIdRec = createRecoveryAzureVm
+ $recRgName = getRecoveryResourceGroupName
+ $index =$v2VmIdRec.IndexOf("/providers/")
+ $recRg =$v2VmIdRec.Substring(0,$index)
+ $RecoveryAzureNetworkId = $recRg + "/providers/Microsoft.Network/virtualNetworks/" + $recRgName
+ $v2VmId = createAzureVm
+ $vmName = getAzureVmName
+ $logStg = createCacheStorageAccount
+ $vm = get-azVm -ResourceGroupName $vmName -Name $vmName
+ $vhdid =$vm.StorageProfile.OSDisk.ManagedDisk.Id
+ $index =$v2VmId.IndexOf("/providers/")
+ $Rg =$v2VmId.Substring(0,$index)
+ $PrimaryAzureNetworkId = $Rg + "/providers/Microsoft.Network/virtualNetworks/" + $vmName
+
+ #network mapping
+ $job = New-AzRecoveryServicesAsrNetworkMapping -AzureToAzure -Name $primaryNetMapping -PrimaryFabric $pf -PrimaryAzureNetworkId $PrimaryAzureNetworkId -RecoveryFabric $rf -RecoveryAzureNetworkId $RecoveryAzureNetworkId
+ WaitForJobCompletion -JobId $job.Name
+
+ #enable Replication
+ $v = New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -managed -LogStorageAccountId $logStg `
+ -DiskId $vhdid -RecoveryResourceGroupId $recRg -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
+ -RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
+ $enableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $v2VmId -Name $vmName -ProtectionContainerMapping $mapping -RecoveryResourceGroupId $recRg -AzureToAzureDiskReplicationConfiguration $v
+ WaitForJobCompletion -JobId $enableDRjob.Name
+ WaitForIRCompletion -affectedObjectId $enableDRjob.TargetObjectId
+
+ #add diskId
+ $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
+ Assert-NotNull($pe)
+
+ #create disk and attach
+ $diskName = getAzureDataDiskName
+ $newDiskConfig = New-AzDiskConfig -Location $vm.Location -CreateOption Empty -DiskSizeGB 5
+ $newDisk = New-AzDisk -ResourceGroupName $vm.ResourceGroupName -DiskName $diskName -Disk $newDiskConfig
+ $vm = Add-AzVMDataDisk -VM $vm -Name $diskName -CreateOption Attach -ManagedDiskId $newDisk.Id -Lun 5
+ Update-azVm -ResourceGroupName $vmName -VM $vm
+
+ #wait for the add-disk health warning to appear
+ Write-Host $("Waiting for Add-Disk health warning...") -ForegroundColor Yellow
+ $HealthQueryWaitTimeInSeconds = 10
+ do
+ {
+ $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
+ $healthError = $pe.ReplicationHealthErrors | where-object {$_.ErrorCode -eq 153039}
+
+ if($healthError -eq $null)
+ {
+ Write-Host $("Waiting for Add-Disk health warning...") -ForegroundColor Yellow
+ Write-Host $("Waiting for: " + $HealthQueryWaitTimeInSeconds.ToString + " Seconds") -ForegroundColor Yellow
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait($HealthQueryWaitTimeInSeconds * 1000)
+ }
+ }While($healthError -eq $null)
+
+ #add disks
+ $disk2= New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -DiskId $newDisk.Id -LogStorageAccountId $pe.ProviderSpecificDetails.A2ADiskDetails[0].PrimaryStagingAzureStorageAccountId -ManagedDisk -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType -RecoveryResourceGroupId $pe.ProviderSpecificDetails.A2ADiskDetails[0].RecoveryResourceGroupId -RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
+ $addDRjob = Add-AzRecoveryServicesAsrReplicationProtectedItemDisk -ReplicationProtectedItem $pe -AzureToAzureDiskReplicationConfiguration $disk2
+ WaitForJobCompletion -JobId $addDRjob.Name
+
+ #get disk to deattach
+ $removeDisk = $pe.ProviderSpecificDetails.A2ADiskDetails | where-object {$_.AllowedDiskLevelOperation.Count -eq 1}
+ Assert-NotNull($removeDisk)
+ $vm = get-azVm -ResourceGroupName $vmName -Name $vmName
+ $removeDiskId = $vm.StorageProfile.DataDisks | Where-Object {$_.ManagedDisk.Name -eq $removeDisk.DiskName}
+ $removeDRjob = Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk -ReplicationProtectedItem $pe -DiskId $removeDiskId.ManagedDisk.Id
+ WaitForJobCompletion -JobId $removeDRjob.Name
+
+ $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
+ Assert-NotNull($pe)
+}
+
+
+<#
+.SYNOPSIS
+ Test ResolveHealthError new parametersets
+#>
+
+function Test-ResolveHealthError{
+ param([string] $seed ='557')
+ $primaryPolicyName = getPrimaryPolicy
+ $recoveryPolicyName = getRecoveryPolicy
+
+ $primaryContainerMappingName = getPrimaryContainerMapping
+ $recoveryContainerMappingName = getRecoveryContainerMapping
+
+ $primaryContainerName = getPrimaryContainer
+ $recoveryContainerName = getRecoveryContainer
+ $vaultRgLocation = getVaultRgLocation
+ $vaultName = getVaultName
+ $vaultLocation = getVaultLocation
+ $vaultRg = getVaultRg
+ $primaryLocation = getPrimaryLocation
+ $recoveryLocation = getRecoveryLocation
+ $primaryFabricName = getPrimaryFabric
+ $recoveryFabricName = getRecoveryFabric
+ $RecoveryReplicaDiskAccountType = "Premium_LRS"
+ $RecoveryTargetDiskAccountType = "Premium_LRS"
+ $policyName = getPrimaryPolicy
+ $mappingName = getPrimaryContainerMapping
+ $primaryNetMapping = getPrimaryNetworkMapping
+
+ New-AzResourceGroup -name $vaultRg -location $vaultRgLocation -force
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
+ # vault Creation
+ New-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName -Location $vaultLocation
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(20 * 1000)
+ $Vault = Get-AzRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName
+ Set-ASRVaultContext -Vault $Vault
+ # fabric Creation
+ ### AzureToAzure New paramset
+ $fabJob= New-AzRecoveryServicesAsrFabric -Azure -Name $primaryFabricName -Location $primaryLocation
+ WaitForJobCompletion -JobId $fabJob.Name
+ $fab = Get-AzRecoveryServicesAsrFabric -Name $primaryFabricName
+ Assert-true { $fab.name -eq $primaryFabricName }
+ Assert-AreEqual $fab.FabricSpecificDetails.Location $primaryLocation
+
+ $fabJob= New-AzRecoveryServicesAsrFabric -Azure -Name $recoveryFabricName -Location $recoveryLocation
+ WaitForJobCompletion -JobId $fabJob.Name
+ $fab = Get-AzRecoveryServicesAsrFabric -Name $recoveryFabricName
+ Assert-true { $fab.name -eq $recoveryFabricName }
+ Assert-AreEqual $fab.FabricSpecificDetails.Location $recoveryLocation
+ $pf = get-asrFabric -Name $primaryFabricName
+ $rf = get-asrFabric -Name $recoveryFabricName
+
+ ### AzureToAzure (Default)
+ $job = New-AzRecoveryServicesAsrProtectionContainer -Name $primaryContainerName -Fabric $pf
+ WaitForJobCompletion -JobId $Job.Name
+ $pc = Get-asrProtectionContainer -name $primaryContainerName -Fabric $pf
+ Assert-NotNull($pc)
+ $job = New-AzRecoveryServicesAsrProtectionContainer -Name $recoveryContainerName -Fabric $rf
+ WaitForJobCompletion -JobId $Job.Name
+ $rc = Get-asrProtectionContainer -name $recoveryContainerName -Fabric $rf
+ Assert-NotNull($rc)
+
+ #create policy and mapping
+ $job = New-AzRecoveryServicesAsrPolicy -Name $policyName -RecoveryPointRetentionInHours 12 -AzureToAzure
+ WaitForJobCompletion -JobId $job.Name
+ $policy = Get-AzRecoveryServicesAsrPolicy -Name $policyName
+ $job = New-AzRecoveryServicesAsrProtectionContainerMapping -Name $mappingName -Policy $policy -PrimaryProtectionContainer $pc -RecoveryProtectionContainer $rc
+ WaitForJobCompletion -JobId $job.Name
+ $mapping = Get-AzRecoveryServicesAsrProtectionContainerMapping -Name $mappingName -ProtectionContainer $pc
+
+ $v2VmIdRec = createRecoveryAzureVm
+ $recRgName = getRecoveryResourceGroupName
+ $index =$v2VmIdRec.IndexOf("/providers/")
+ $recRg =$v2VmIdRec.Substring(0,$index)
+ $RecoveryAzureNetworkId = $recRg + "/providers/Microsoft.Network/virtualNetworks/" + $recRgName
+ $v2VmId = createAzureVm
+ $vmName = getAzureVmName
+ $logStg = createCacheStorageAccount
+ $vm = get-azVm -ResourceGroupName $vmName -Name $vmName
+ $vhdid =$vm.StorageProfile.OSDisk.ManagedDisk.Id
+ $index =$v2VmId.IndexOf("/providers/")
+ $Rg =$v2VmId.Substring(0,$index)
+ $PrimaryAzureNetworkId = $Rg + "/providers/Microsoft.Network/virtualNetworks/" + $vmName
+
+ #network mapping
+ $job = New-AzRecoveryServicesAsrNetworkMapping -AzureToAzure -Name $primaryNetMapping -PrimaryFabric $pf -PrimaryAzureNetworkId $PrimaryAzureNetworkId -RecoveryFabric $rf -RecoveryAzureNetworkId $RecoveryAzureNetworkId
+ WaitForJobCompletion -JobId $job.Name
+
+ #enable Replication
+ $v = New-AzRecoveryServicesAsrAzureToAzureDiskReplicationConfig -managed -LogStorageAccountId $logStg `
+ -DiskId $vhdid -RecoveryResourceGroupId $recRg -RecoveryReplicaDiskAccountType $RecoveryReplicaDiskAccountType `
+ -RecoveryTargetDiskAccountType $RecoveryTargetDiskAccountType
+ $enableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $v2VmId -Name $vmName -ProtectionContainerMapping $mapping -RecoveryResourceGroupId $recRg -AzureToAzureDiskReplicationConfiguration $v
+ WaitForJobCompletion -JobId $enableDRjob.Name
+ WaitForIRCompletion -affectedObjectId $enableDRjob.TargetObjectId
+
+ #add diskId
+ $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
+ Assert-NotNull($pe)
+
+ #create disk and attach
+ $diskName = getAzureDataDiskName
+ $newDiskConfig = New-AzDiskConfig -Location $vm.Location -CreateOption Empty -DiskSizeGB 5
+ $newDisk = New-AzDisk -ResourceGroupName $vm.ResourceGroupName -DiskName $diskName -Disk $newDiskConfig
+ $vm = Add-AzVMDataDisk -VM $vm -Name $diskName -CreateOption Attach -ManagedDiskId $newDisk.Id -Lun 5
+ Update-azVm -ResourceGroupName $vmName -VM $vm
+
+ #wait for the add-disk health warning to appear
+ Write-Host $("Waiting for Add-Disk health warning...") -ForegroundColor Yellow
+ $HealthQueryWaitTimeInSeconds = 10
+ do
+ {
+ $pe = Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $pc -Name $vmName
+ $healthError = $pe.ReplicationHealthErrors | where-object {$_.ErrorCode -eq 153039}
+
+ if($healthError -eq $null)
+ {
+ Write-Host $("Waiting for Add-Disk health warning...") -ForegroundColor Yellow
+ Write-Host $("Waiting for: " + $HealthQueryWaitTimeInSeconds.ToString + " Seconds") -ForegroundColor Yellow
+ [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait($HealthQueryWaitTimeInSeconds * 1000)
+ }
+ }While($healthError -eq $null)
+
+ #resolve health error
+ $addDRjob = Remove-AzureRmRecoveryServicesAsrReplicationProtectedItemHealthError -ReplicationProtectedItem $pe -ErrorId $healthError.ErrorId
+ WaitForJobCompletion -JobId $addDRjob.Name
+}
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/Common/PSAsrReplicationProtectedItemsClient.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/Common/PSAsrReplicationProtectedItemsClient.cs
index b01847fe9494..a638b06b2f33 100644
--- a/src/RecoveryServices/RecoveryServices.SiteRecovery/Common/PSAsrReplicationProtectedItemsClient.cs
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/Common/PSAsrReplicationProtectedItemsClient.cs
@@ -162,6 +162,62 @@ public PSSiteRecoveryLongRunningOperation AddDisks(
return result;
}
+ ///
+ /// Remove disks from replication protected item.
+ ///
+ /// Fabric Name
+ /// Protection Container Name
+ /// Replication Protected Item Name
+ /// Remove disks input.
+ /// Job response
+ 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(op);
+ return result;
+ }
+
+ ///
+ /// Removes the Health error from replication protected item.
+ ///
+ /// Fabric Name
+ /// Protection Container Name
+ /// Replication Protected Item Name
+ /// Remove disks input.
+ /// Job response
+ public PSSiteRecoveryLongRunningOperation ResolveHealthError(
+ string fabricName,
+ string protectionContainerName,
+ string replicationProtectedItemName,
+ ResolveHealthInput input)
+ {
+ var op = this.GetSiteRecoveryClient()
+ .ReplicationProtectedItems.BeginResolveHealthErrorsWithHttpMessagesAsync(
+ fabricName,
+ protectionContainerName,
+ replicationProtectedItemName,
+ input,
+ this.GetRequestHeaders(true))
+ .GetAwaiter()
+ .GetResult();
+
+ var result = SiteRecoveryAutoMapperProfile.Mapper.Map(op);
+ return result;
+ }
+
///
/// Retrieves Protected Items.
///
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSEvent.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSEvent.cs
index 64c191ea6a6f..122b58e53f96 100644
--- a/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSEvent.cs
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSEvent.cs
@@ -213,6 +213,8 @@ public ASRHealthError(HealthError healthError)
this.ErrorMessage = healthError.ErrorMessage;
this.PossibleCauses = healthError.PossibleCauses;
this.RecommendedAction = healthError.RecommendedAction;
+ this.ErrorId = healthError.ErrorId;
+ this.CustomerResolvability = healthError.CustomerResolvability;
this.RecoveryProviderErrorMessage = healthError.RecoveryProviderErrorMessage;
}
@@ -255,6 +257,16 @@ public ASRHealthError(HealthError healthError)
/// Recovery Provider error message.
///
public string RecoveryProviderErrorMessage { get; set; }
+
+ ///
+ /// Id of error.
+ ///
+ public string ErrorId { get; set; }
+
+ ///
+ /// CustomerResolvability of error.
+ ///
+ public string CustomerResolvability { get; set; }
}
///
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemDisk.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemDisk.cs
new file mode 100644
index 000000000000..ddb6893e3db3
--- /dev/null
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemDisk.cs
@@ -0,0 +1,124 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Management.Automation;
+using System.Collections.Generic;
+using Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models;
+using Job = Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models.Job;
+
+namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery
+{
+ ///
+ /// Removes disks to replication protected item.
+ ///
+ [Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrReplicationProtectedItemDisk", DefaultParameterSetName = ASRParameterSets.AzureToAzure, SupportsShouldProcess = true)]
+ [Alias("Remove-ASRReplicationProtectedItemDisk")]
+ [OutputType(typeof(ASRJob))]
+ public class RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemDisk : SiteRecoveryCmdletBase
+ {
+ [Parameter(Mandatory = true, ValueFromPipeline = true)]
+ [ValidateNotNullOrEmpty]
+ [Alias("ReplicationProtectedItem")]
+ public ASRReplicationProtectedItem InputObject { get; set; }
+
+ ///
+ /// Gets or sets the disk uri.
+ ///
+ [Parameter(ParameterSetName = ASRParameterSets.AzureToAzure, Mandatory = true)]
+ [ValidateNotNullOrEmpty]
+ public string[] VhdUri { get; set; }
+
+ ///
+ /// Gets or sets the disk Id.
+ ///
+ [Parameter(ParameterSetName = ASRParameterSets.AzureToAzureManagedDisk, Mandatory = true)]
+ [ValidateNotNullOrEmpty]
+ public string[] DiskId { get; set; }
+
+ ///
+ /// ProcessRecord of the command.
+ ///
+ public override void ExecuteSiteRecoveryCmdlet()
+ {
+ base.ExecuteSiteRecoveryCmdlet();
+
+ // check for A2A protected item - if providerSpecificDetails is A2AReplicationDetails.
+
+ var removeDisksProviderSpecificInput = new RemoveDisksProviderSpecificInput();
+ var inputProperties = new RemoveDisksInputProperties
+ {
+ ProviderSpecificDetails = removeDisksProviderSpecificInput
+ };
+ var input = new RemoveDisksInput { Properties = inputProperties };
+ FillRemoveDiskInputForAzureToAzureReplication(input);
+
+ if (this.ShouldProcess(
+ this.InputObject.FriendlyName,
+ "Removes the protected disk"))
+ {
+ PSSiteRecoveryLongRunningOperation response =
+ this.RecoveryServicesClient.RemoveDisks(
+ Utilities.GetValueFromArmId(
+ this.InputObject.ID,
+ ARMResourceTypeConstants.ReplicationFabrics),
+ Utilities.GetValueFromArmId(
+ this.InputObject.ID,
+ ARMResourceTypeConstants.ReplicationProtectionContainers),
+ this.InputObject.Name,
+ input);
+
+ this.jobResponse = this.RecoveryServicesClient.GetAzureSiteRecoveryJobDetails(
+ PSRecoveryServicesClient.GetJobIdFromReponseLocation(response.Location));
+
+ this.WriteObject(new ASRJob(this.jobResponse));
+ }
+ }
+
+ ///
+ /// Helper method to fill in input details.
+ ///
+ private void FillRemoveDiskInputForAzureToAzureReplication(RemoveDisksInput input)
+ {
+ var providerSettings = new A2ARemoveDisksInput()
+ {
+ VmDisksUris = new List(),
+ VmManagedDisksIds = new List()
+ };
+
+ switch (this.ParameterSetName)
+ {
+ case ASRParameterSets.AzureToAzure:
+ providerSettings.VmDisksUris = this.VhdUri;
+ break;
+ case ASRParameterSets.AzureToAzureManagedDisk:
+ providerSettings.VmManagedDisksIds = this.DiskId;
+ break;
+ }
+
+ input.Properties.ProviderSpecificDetails = providerSettings;
+ }
+
+ ///
+ /// Writes Job.
+ ///
+ /// Job object.
+ private void WriteJob(
+ Job job)
+ {
+ this.WriteObject(new ASRJob(job));
+ }
+
+ private Job jobResponse;
+ }
+}
diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemHealthError.cs b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemHealthError.cs
new file mode 100644
index 000000000000..3fe09b192d68
--- /dev/null
+++ b/src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemHealthError.cs
@@ -0,0 +1,98 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Management.Automation;
+using System.Collections.Generic;
+using Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models;
+using Job = Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models.Job;
+
+namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery
+{
+ ///
+ /// Removes health error for the replication protected item.
+ ///
+ [Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrReplicationProtectedItemHealthError", DefaultParameterSetName = ASRParameterSets.AzureToAzure, SupportsShouldProcess = true)]
+ [Alias("Remove-ASRReplicationProtectedItemHealthError")]
+ [OutputType(typeof(ASRJob))]
+ public class RemoveAzureRmRecoveryServicesAsrReplicationProtectedItemHealthError : SiteRecoveryCmdletBase
+ {
+ [ValidateNotNullOrEmpty]
+ [Parameter(Mandatory = true)]
+ public ASRReplicationProtectedItem ReplicationProtectedItem { get; set; }
+
+ ///
+ /// Gets or sets the errro id.
+ ///
+ [Parameter(Mandatory = true)]
+ [ValidateNotNullOrEmpty]
+ public string[] ErrorId { get; set; }
+
+ ///
+ /// ProcessRecord of the command.
+ ///
+ public override void ExecuteSiteRecoveryCmdlet()
+ {
+ base.ExecuteSiteRecoveryCmdlet();
+
+ var input = new ResolveHealthInput { Properties = new ResolveHealthInputProperties() };
+ FillResolveHealthErrorInput(input);
+
+ if (this.ShouldProcess(
+ this.ReplicationProtectedItem.FriendlyName,
+ "Removes the protected item's health error"))
+ {
+ PSSiteRecoveryLongRunningOperation response =
+ this.RecoveryServicesClient.ResolveHealthError(
+ Utilities.GetValueFromArmId(
+ this.ReplicationProtectedItem.ID,
+ ARMResourceTypeConstants.ReplicationFabrics),
+ Utilities.GetValueFromArmId(
+ this.ReplicationProtectedItem.ID,
+ ARMResourceTypeConstants.ReplicationProtectionContainers),
+ this.ReplicationProtectedItem.Name,
+ input);
+
+ this.jobResponse = this.RecoveryServicesClient.GetAzureSiteRecoveryJobDetails(
+ PSRecoveryServicesClient.GetJobIdFromReponseLocation(response.Location));
+
+ this.WriteObject(new ASRJob(this.jobResponse));
+ }
+ }
+
+ ///
+ /// Helper method to fill in input details.
+ ///
+ private void FillResolveHealthErrorInput(ResolveHealthInput input)
+ {
+ input.Properties.HealthErrors = new List();
+
+ foreach (string errorId in ErrorId)
+ {
+ input.Properties.HealthErrors.Add(new ResolveHealthError(errorId));
+ }
+ }
+
+ ///
+ /// Writes Job.
+ ///
+ /// Job object.
+ private void WriteJob(
+ Job job)
+ {
+ this.WriteObject(new ASRJob(job));
+ }
+
+ private Job jobResponse;
+ }
+}
diff --git a/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1 b/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1
index abfcb4d04273..75436eb91280 100644
--- a/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1
+++ b/src/RecoveryServices/RecoveryServices/Az.RecoveryServices.psd1
@@ -132,7 +132,9 @@ CmdletsToExport =
'Remove-AzRecoveryServicesAsrProtectionContainer',
'Remove-AzRecoveryServicesAsrProtectionContainerMapping',
'Remove-AzRecoveryServicesAsrRecoveryPlan',
- 'Remove-AzRecoveryServicesAsrReplicationProtectedItem',
+ 'Remove-AzRecoveryServicesAsrReplicationProtectedItem',
+ 'Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk',
+ 'Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError',
'Remove-AzRecoveryServicesAsrServicesProvider',
'Remove-AzRecoveryServicesAsrStorageClassificationMapping',
'Remove-AzRecoveryServicesAsrvCenter',
@@ -217,7 +219,9 @@ AliasesToExport = 'Get-AzRecoveryServicesBackupProperties',
'New-ASRStorageClassificationMapping', 'New-ASRvCenter',
'Remove-ASRFabric', 'Remove-ASRNetworkMapping', 'Remove-ASRPolicy',
'Remove-ASRProtectionContainerMapping', 'Remove-ASRRP',
- 'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
+ 'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
+ 'Remove-ASRReplicationProtectedItemDisk',
+ 'Remove-ASRReplicationProtectedItemHealthError',
'Remove-ASRServicesProvider',
'Remove-ASRStorageClassificationMapping', 'Remove-ASRvCenter',
'Restart-ASRJob', 'Resume-ASRJob', 'Set-ASRAlertSetting',
diff --git a/src/RecoveryServices/RecoveryServices/help/Az.RecoveryServices.md b/src/RecoveryServices/RecoveryServices/help/Az.RecoveryServices.md
index eee44c2c1c23..a89bbc552c81 100644
--- a/src/RecoveryServices/RecoveryServices/help/Az.RecoveryServices.md
+++ b/src/RecoveryServices/RecoveryServices/help/Az.RecoveryServices.md
@@ -1,4 +1,4 @@
----
+---
Module Name: Az.RecoveryServices
Module Guid: 4aa53b7e-fcfe-4e22-979c-9a4e6380de58
Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices
@@ -212,6 +212,12 @@ Deletes the specified ASR recovery plan from Recovery Services vault.
### [Remove-AzRecoveryServicesAsrReplicationProtectedItem](Remove-AzRecoveryServicesAsrReplicationProtectedItem.md)
Stops/Disables replication for an Azure Site Recovery replication protected item.
+### [Remove-AzRecoveryServicesAsrReplicationProtectedItem](Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk.md)
+Removes a protected disk from replication protected item.
+
+### [Remove-AzRecoveryServicesAsrReplicationProtectedItem](Remove-AzRecoveryServicesAsrReplicationProtectedItemHealth.md)
+Removes the health error from replication protected item.
+
### [Remove-AzRecoveryServicesAsrServicesProvider](Remove-AzRecoveryServicesAsrServicesProvider.md)
Deletes/unregister the specified Azure Site Recovery recovery services provider from the recovery services vault.
diff --git a/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk.md b/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk.md
new file mode 100644
index 000000000000..f6481961c411
--- /dev/null
+++ b/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk.md
@@ -0,0 +1,169 @@
+---
+external help file: Microsoft.Azure.PowerShell.Cmdlets.RecoveryServices.SiteRecovery.dll-Help.xml
+Module Name: Az.RecoveryServices
+online version: https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices/remove-azrecoveryservicesasrreplicationprotecteditemDisk
+schema: 2.0.0
+---
+
+# Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk
+
+## SYNOPSIS
+Removes disks to replication protected item.
+
+## SYNTAX
+
+### AzureToAzure (Default)
+```
+Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk -InputObject
+ -VhdUri [-WaitForCompletion] [-DefaultProfile ] [-WhatIf] [-Confirm]
+ []
+```
+
+### AzureToAzureManagedDisk
+```
+Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk -InputObject
+ -DiskId [-WaitForCompletion] [-DefaultProfile ] [-WhatIf] [-Confirm]
+ []
+```
+
+## DESCRIPTION
+The **Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk** cmdlet removes the disk from the ASR replication protected item.
+
+## EXAMPLES
+
+### Example 1
+```powershell
+PS C:\> Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk -ReplicationProtectedItem $rpi -VhdUri $vhdUri
+```
+
+Start the operation to remove specified disk from protection VM for unManaged disk.
+
+### Example 2
+```powershell
+PS C:\> Remove-AzRecoveryServicesAsrReplicationProtectedItemDisk -ReplicationProtectedItem $rpi -DiskId $diskId
+```
+
+Start the operation to remove specified disk from protection VM for Managed disk.
+
+## PARAMETERS
+
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: IAzureContextContainer
+Parameter Sets: (All)
+Aliases: AzContext, AzureRmContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DiskId
+Specifies the list of managed disk Ids.
+
+```yaml
+Type: String[]
+Parameter Sets: AzureToAzureManagedDisk
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -InputObject
+The input object to the cmdlet: The ASR replication protected item object corresponding to which disk is to be removed.
+
+```yaml
+Type: ASRReplicationProtectedItem
+Parameter Sets: (All)
+Aliases: ReplicationProtectedItem
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByValue)
+Accept wildcard characters: False
+```
+
+### -VhdUri
+Specifies the list of vhd Uri's.
+
+```yaml
+Type: String[]
+Parameter Sets: AzureToAzure
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WaitForCompletion
+Wait For Completion
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRReplicationProtectedItem
+
+## OUTPUTS
+
+### Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRJob
+
+## NOTES
+
+## RELATED LINKS
diff --git a/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError.md b/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError.md
new file mode 100644
index 000000000000..576f7dab45fd
--- /dev/null
+++ b/src/RecoveryServices/RecoveryServices/help/Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError.md
@@ -0,0 +1,139 @@
+---
+external help file: Microsoft.Azure.PowerShell.Cmdlets.RecoveryServices.SiteRecovery.dll-Help.xml
+Module Name: Az.RecoveryServices
+online version: https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices/remove-azrecoveryservicesasrreplicationprotecteditemHealthError
+schema: 2.0.0
+---
+
+# Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError
+
+## SYNOPSIS
+Removes the health error from the ASR replication protected item.
+
+## SYNTAX
+
+```
+Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError
+ -ReplicationProtectedItem -ErrorId [-WaitForCompletion]
+ [-DefaultProfile ] [-WhatIf] [-Confirm] []
+```
+
+## DESCRIPTION
+The **Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError** cmdlet removes the health from the already protected azure virtual machine.
+
+## EXAMPLES
+
+### Example 1
+```powershell
+PS C:\> Remove-AzRecoveryServicesAsrReplicationProtectedItemHealthError -ReplicationProtectedItem $rpi -ErrorIds $errorId
+```
+
+Start the operation to remove the health errors from the ASR Replication protected item.
+
+## PARAMETERS
+
+### -Confirm
+Prompts you for confirmation before running the cmdlet.
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases: cf
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: IAzureContextContainer
+Parameter Sets: (All)
+Aliases: AzContext, AzureRmContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ErrorId
+Health Error Ids.
+
+```yaml
+Type: String[]
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ReplicationProtectedItem
+The input object to the cmdlet: The ASR replication protected item object corresponding to which the helath error is to be removed.
+
+```yaml
+Type: ASRReplicationProtectedItem
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WaitForCompletion
+Wait For Completion
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -WhatIf
+Shows what would happen if the cmdlet runs.
+The cmdlet is not run.
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases: wi
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### None
+
+## OUTPUTS
+
+### Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRJob
+
+## NOTES
+
+## RELATED LINKS