Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static IP address for Role in Windows Azure?

Does anyone knows if obtaining a static IP address for a Web or Worker Role on Windows Azure is possible (possibly only in private beta)?

like image 704
Joannes Vermorel Avatar asked Jun 23 '11 08:06

Joannes Vermorel


People also ask

Where should you use a static IP address in Azure?

1 Answer. We use a static IP address when we do not want to change the address connected to the device. A dynamic IP address is used when we want to change the address and assign other devices to access it.

Do Azure functions have static IP?

You can control the IP address of outbound traffic from your functions by using a virtual network NAT gateway to direct traffic through a static public IP address. You can use this topology when running in a Premium plan or in a Dedicated (App Service) plan.


2 Answers

A few years later, Azure now lets you reserve IP addresses for VMs and cloud services (Web and Worker roles). However, it is only accessible from PowerShell for the time being (this will change in the future, apparently).

The first five static IP addresses are free. To create an IP you will need to make sure you have the latest version of the Azure PowerShell command-line interface and also have your Azure account linked to Azure PowerShell (outside the scope of this post but not hard).

To Create a new IP in PowerShell:

$ReservedIP = New-AzureReservedIP -ReservedIPName "FirewallIP" -Label "WebAppFirewallIP" -Location "Japan West"

To associate it with a VM:

New-AzureVMConfig -Name "WebAppVM" -InstanceSize Small -ImageName $images[60].ImageName | Add-AzureProvisioningConfig -Windows -AdminUsername cloudguy -Password Abc123 | New-AzureVM -ServiceName "WebApp" –ReservedIPName $ReservedIP -Location "Japan West"

To insert your new IP into a Web or Worker Role (if the worker role has an external endpoint), add the following to ServiceConfiguration.Cloud.cscfg:

<ServiceConfiguration>
  <NetworkConfiguration>
    <AddressAssignments>
      <ReservedIPs>
        <ReservedIP name="<reserved-ip-name>"/>
      </ReservedIPs>
    </AddressAssignments>
  </NetworkConfiguration>
</ServiceConfiguration>

To view an IP at any time:

Get-AzureReservedIP -ReservedIPName "FirewallIP"

Source: Documentation

like image 177
user1393477 Avatar answered Oct 05 '22 18:10

user1393477


There's an update to this story. Back in October 2011, Microsoft announced improved in-place updates to existing deployed services (announcement here). You can now update your deployment in several ways without having the assigned IP address changed. For example:

  • Grow/shrink Role size
  • Increase local storage size
  • Change endpoints
  • Add / remove roles

Once you deploy: As long as you don't delete your deployment, your IP address will stay as-is.

like image 27
David Makogon Avatar answered Oct 05 '22 20:10

David Makogon