简体   繁体   中英

Assign VNet IP address to Azure Cloud Service

I have an Azure Cloud Service, and a Azure Virtual Network with Subnet. I can deploy the Cloud Service onto the Virtual Network by setting the appropriate configuration setting in the .cscfg.

What I'm struggling with though is bringing the role onto a specific IP address. My guess is that it's currently using DHCP to get an IP address.

I've tried using the following Powershell:

Get-AzureVM -ServiceName myrole | Set-AzureStaticVNetIP -IPAddress 127.16.0.4 | Update-AzureVM

But the IP address never changes:

<IpAddress>172.16.0.5</IpAddress>

Is there a restriction on doing this on cloud services?

Any help would be really appreciated.

Thanks,

Graeme

Network configuration schema for Cloud Service is documented here. https://msdn.microsoft.com/library/azure/jj156091.aspx

As you'll see, you have the ability to specify a ReservedIP but not a static private IP.

My understanding is that Set-AzureStaticVNetIP works for Azure IaaS VM, not for Cloud Service VM. Virtual machines whether there are IaaS or Paas provisioned in a VNET are always allocated the first available IP address in the subnet after the first 4 addresses which are reserved from .0 to .3.

So considering your request, I will define subnets that enable to target the right subnet IPs for my role instances, and if I need to precisely know which IP is used by which instance, read it in the "role start" method and use it to configure whatever solution you need for this IP to be be "static". Hope this helps Best regards Stéphane

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM