VM to VM communication for VMs running on Windows Azure is not just up and straightforward and wide open like it is when you run a VM on a hypervisor in the enterprise.
By design, Role Instances (these are VMs) in Azure have an outer security wrapper around them. This establishes that final trust boundary for the VM container. You can see this when you use VM Role. Because beyond your Windows Advanced Firewall you have an additional level of block to your network connectivity.
This is where you must define your endpoints (and you must know your application and the required ports very well) within your Azure Service.
In the properties of any Azure Role is the Endpoints property. these are little port specific pin-pricks in the Azure VM runtime container specific to network traffic. You poke a hole, you allow incoming traffic on that particular port. Don’t get hung up on the endpoint term – it is very much a developer type term for “something that I can connect to, or talk to.”
The Name is whatever you (or your developer) calls it. the type is Input or Internal. The Protocol is HTTP, TCP, or HTTPS. Public ports apply to Input endpoints. Private port applies to both Input and Internal endpoints.
An Input endpoint is where your Azure Service is exposed to the wild world. It is the public port that anyone can touch.
An Internal endpoint is internal to your Azure Service and is where any Role Instance can touch another Role Instance over the network. Here you set the Private Port number.
This opens a port in the envelope that allows incoming traffic to the role instance where this is defined. And in the case of a public port, it maps that through a load balancer to a public IP. Otherwise, your internal traffic is over an internal IP subnet (not a public range).
I envision this to look a little like this:
Now, the tricky part comes next. The setup of your application in Azure can be exceedingly complex because of one rule that Azure has; your OS images are prepared with sysprep. This is so that any Role can exists as multiple instances and be totally unique.
Under the hood, there are traditional Windows Setup and Deployment tricks happening all over the place. Unattended setup, pre-tasks, post-tasks, user elevation, injection of applications, certificate installation – all kinds of things are happening or can happen when a Role Instance is provisioned. This is all related to the Azure way of doing things.
Think about this. You have an enterprise application. Does it support being sysprep’d? Many don’t.
Also, how does your application behave without any type of name resolution?
And, how do you discover your other role instances without connecting to and logging into each one?
For Web and Worker roles Microsoft wants you to use the AppFabric or Azure Storage (blobs, queues, tables) to enable this communication. But what if re-writing is not an option?