Using a Static IP Address with Azure Site Recovery

Understand how to use static IP addresses when using Azure Site Recovery.

John Savill

December 8, 2014

1 Min Read
IP address

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.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like