Skip navigation
IP address

Using a Static IP Address with Azure Site Recovery

Q: How are static IP addresses handled by Azure Site Recovery?

A: Azure Site Recovery has several replication channels available for site-to-site (your sites). In Windows Server 2012 and later, for Hyper-V to Azure, Azure Site Recovery uses Hyper-V Replica; for VMware to Azure, it uses InMage Scout. Each approach handles static IP addresses differently.

For site-to-site, if a virtual machine has a static IP address, then Azure Site Recovery automatically reserves an IP address for the virtual machine when protection is enabled. This IP address is injected into the virtual machine during a failover.

For site to Azure, you would perform the IP address injection as part of your runbook. The following code shows an example Azure Automation runbook that sets a virtual machine with a static IP address.

workflow SavillTestStaticIP
{
    param(
       [Object]$RecoveryPlanContext
    )
    
    $AzureConnectionName = "SavillTech Internal Consumption"
    $VMMVMGUID = "3c396415-0fba-4a00-nnnn-nnnnnnnnnnnn";
    $IP = "10.7.115.14"
     
    
    Connect-Azure -AzureConnectionName $AzureConnectionName
    Select-AzureSubscription -SubscriptionName $AzureConnectionName
    
    $VMContext = $RecoveryPlanContext.VmMap.$VMMVMGUID
    
    Write-Output $VMContext
    
    if ($VMContext -ne $null) 
    {    
        InlineScript 
        {
            Get-AzureVM -ServiceName $Using:VMContext.CloudServiceName  -Name $Using:VMContext.RoleName | `
            Set-AzureStaticVNetIP -IPAddress $Using:IP | Update-AzureVM
        }
    }

}

Note that the actual virtual machine to be modified is automatically fetched from the recovery plan and stored in the $VMContext variable.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish