Reserving the IP address currently assigned to a Cloud Service

When deploying a cloud service, you will be assigned a random Public Virtual IP (VIP) address.  This address will change if you delete your Web/Worker role and then deploy another version of your code.

With the latest release of the Azure PowerShell Cmdlets, you can now reserve the VIP address that was assigned to your Web/Worker role by using the following cmdlet.

New-AzureReservedIP –ReservedIPName <name of reservation> –Location <region> –ServiceName <name of your service>

eg: New-AzureReservedIP –ReservedIPName “myIPReservation” –Location “Australia East” –ServiceName “myWorkerRoleName”

Check if the reservation has been successful by executing the following cmdlet: Get-AzureReservedIP. Note the InUse should be True and the ServiceName is the name of your Web/Worker role.

image

Now to ensure that your cloud service will always use the reserved IP address with each new deployment, you will need to update the Service Configuration Schema (CSCFG) and add the ReservedIP element.

   1: <ServiceConfiguration serviceName="TCPSocketListener" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">

   2:   <Role name="WorkerRole1">

   3:     <Instances count="1" />

   4:     <ConfigurationSettings>

   5:     </ConfigurationSettings>

   6:   </Role>

   7:   <NetworkConfiguration>

   8:     <AddressAssignments>

   9:       <ReservedIPs>

  10:         <ReservedIP name="MyCloudServiceName"/>

  11:       </ReservedIPs>

  12:     </AddressAssignments>

  13:   </NetworkConfiguration>

  14: </ServiceConfiguration>

Advertisements
This entry was posted in Azure and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s