Azure / azure-powershell

Microsoft Azure PowerShell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https://learn.microsoft.com/en-us/powershell/module/az.recoveryservices/update-azrecoveryservicesasrprotectiondirection?view=azps-12.1.0&viewFallbackFrom=azps-6.3.0[Doc]:

sgannavaram opened this issue · comments

Type of issue

Code doesn't work

Feedback

I've created a simple runbook in Azure Automation to kick off a failover in site recovery referencing a recovery plan. Failover works fine, the issue comes to when I need to "failback". This starts with a re-protect to re-replicate traffic from the backup region back to the source region. In the Azure GUI, this is performed via the "Re-Protect" button in the Recovery Plan. In PowerShell, this re-protect should be performed with the cmdlet:

Update-AzRecoveryServicesAsrProtectionDirection

Following this documentation:
https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices/update-azrecoveryservicesasrprotectiondirection?view=azps-6.3.0

Steps to reproduce
The following code is being used to attempt to initiate a re-protection action, this is done post failover from primary region to backup region:

$vault = Get-AzRecoveryServicesVault -Name $RecoveryVaultName -ResourceGroupName $RecoveryVaultRG
Set-AzRecoveryServicesAsrVaultContext -Vault $vault

$RP = Get-AzRecoveryServicesAsrRecoveryPlan -Name $RecoveryPlanName

$job = Update-AzRecoveryServicesAsrProtectionDirection -RecoveryPlan $RP -Direction RecoveryToPrimary

Page URL

https://learn.microsoft.com/en-us/powershell/module/az.recoveryservices/update-azrecoveryservicesasrprotectiondirection?view=azps-12.1.0&viewFallbackFrom=azps-6.3.0

Content source URL

No response

Author

No response

Document Id

No response

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Sharmistha-Rai.

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Sharmistha-Rai.