virtual IP address

Use Reserved IP Address for Cloud Service and VM in Virtual Network

Q: Can I configure a reserved IP address for a cloud service hosting IaaS virtual machines and set the virtual machine to be part of a virtual network?

A: It's possible to reserve IP addresses for the lifetime of an Azure subscription, which ensures that the cloud service maintains the same public IP address even if the service is deprovisioned at some point. (See "Reserved IP addresses for Cloud Services & Virtual Machines" for more information.) The reserved IP address isn't assigned to the virtual machine but instead to the cloud service the virtual machine is created in. The reserved IP address is used for the cloud service virtual IP address. This reserved IP address for the cloud service virtual IP address is completely separate from the dynamic IP address the virtual machine has, which can be part of a virtual network and virtual subnet. The following code shows an example of reserving a new IP address, then using it in a new virtual machine creation that also creates a new cloud service.

#This code just finds the latest Windows Server 2012 R2 Datacenter image
$images = Get-AzureVMImage
$2012R2imgs = @() #Create array of objects
foreach ($image in $images)
    if ($image.Label.Contains("Windows Server 2012 R2 Datacenter"))
        $2012R2imgs += $image
$2012R2imgs = $2012R2imgs | Sort-Object PublishedDate -Descending #put the newest first which is the highest patched version

#Create a new Reserved IP address
$ReservedIP = New-AzureReservedIP –ReservedIPName "TestReserve1" –Label "TestReserve1" –Location "East US"

#Use the new Reserved IP address also note a Virtual Subnet and Virtual Network are specified, App-Net and VirtNet115 respectively
New-AzureVMConfig -Name "TestVM55" -InstanceSize 'Basic_A2' -ImageName $2012R2imgs[0].ImageName | 
    Add-AzureProvisioningConfig -Windows -AdminUsername cloudguy -Password Pa55word!123 | 
    Set-AzureSubnet 'App-Net' |
    New-AzureVM -ServiceName "SavillTech103" –ReservedIPName 'TestReserve1' -Location 'East US' -VNetName 'VirtNet115'
Hide 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.