Azure / Azure/azure-quickstart-templates

ASR-AddPublicIP Does Not Recognize Failover Groups

Open
#8,744 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

[ASR-AddPublicIP](https://github.com/Azure/azure-quickstart-templates/blob/master/asr-automation-recovery/scripts/ASR-AddPublicIp.ps1)

### Issue Details
Identified by a Microsoft employee, the AddPublicIP script seems to work intermittently, and is currently still using the older "AzureRM" module. We have identified that, when added to a Recovery Plan with more than one failover group, this script will add a public IP address to ALL VMs in the recovery plan, rather than the ones in the specific group where the post action is added.

This seems to be due to line 76 where it's getting the name of the target resource group where all VMs are failed over to.

Try
--
  | {
  | $VMs = Get-AzureRmVm -ResourceGroupName $RGName
  | Write-Output ("Found the following VMs: `n " + $VMs.Name)
  | }

### Repro steps (*if necessary, delete otherwise*)
1. In Azure, create a recovery services vault, and at least two VMs.
2. Enable disaster recovery for both VMs and wait for replication to complete.
3. In the recovery services vault, navigate to "Recovery Plans" and create a new recovery plan.
4. Create two failover groups, adding a VM to each one.
5. In one of the groups "post actions" add the ASR-AddPublicIP script.
6. Perform a test failover.
7. Note that one of two situations occurred.. All VMs now have a public IP address, or the script failed to find any VMs and did not add any IPs.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with asr-automation-recovery/scripts/ASR-AddPublicIp.ps1, especially line 76 and the Get-AzureRmVm lookup. Follow the listed recovery-plan repro steps with two failover groups, then verify that the script finds only the VMs in the group where the post action is configured and does not add public IPs to the other group.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.