Windows Azure Cloud Services and Virtual Networks
Join the DZone community and get the full member experience.Join For Free
windows azure has historically been a pure paas solution with the deployment unit for compute being a hosted service comprising an optional web role and zero or more worker roles. each role is deployed as one or more virtual machine instances. a hosted service formed a security boundary, with the only way to access role instances being through the load-balanced public input endpoint. role instances inside a hosted service can communicate directly using internal endpoints which provided lower latency because they didn’t go through the windows azure load balancer.
in june 2012, microsoft announced previews of windows azure virtual machines, an iaas offering, and windows azure virtual networks. it also brought a name change from hosted service to cloud service for the compute deployment unit. there is a little bit of confusion about the use of cloud services because, to make the deployment of a single virtual machine as simple as possible, a cloud service is implicitly created when a single iaas virtual machine is deployed. this cloud service is only made apparent in certain circumstances such as the deletion of the virtual machine or the association of a second virtual machine with the first.
microsoft simultaneously announced a preview of windows azure web sites (waws) which provides a scalable, high-density, web hosting solution. the emphasis in waws is on ease of deployment which is far better with waws than it was with paas web roles. however, this ease of deployment comes with more restrictions on deployments than there had been with traditional paas web roles.
at any given time, a cloud service hosts either a paas deployment or an iaas deployment – but not both. either a paas service or an iaas service can be deployed into an empty cloud service. some of this functionality is not exposed on the windows azure portal, and can only be achieved using either powershell or script cmdlets.
the (awesome) windows azure platform training kit contains a hands-on lab (windows azure web sites and virtual machines using asp.net and sql server) which uses a windows azure web site as the front end for a virtual machine hosting sql server. this hol uses a public endpoint for the sql server virtual machine – which consequently means there is a raw sql server endpoint sitting on the public internet.
hanu kommalapati has posted an interesting example which hosts a cassandra cluster in 3 virtual machines with a front-end provided by a another virtual machine running a web server developed in node.js . this example also uses a public endpoint for the cassandra cluster – which consequently means there is a raw cassandra endpoint sitting on the public internet.
virtual networks improves the composition of cloud services by allowing one or more of them to be added to a virtual network. note that when a virtual network is used to host cloud services, the security boundary is extended to comprise all the cloud services in the virtual network. a cloud service in a virtual network can directly access individual instances in a second cloud service contained in the virtual network without going through the load balancer hosting a public input endpoint for the second cloud service. this means that once a traditional paas cloud service is added to a virtual network the cloud service no longer forms a security boundary and any open port on its role instances can be accessed by any instance of any cloud service in the virtual network. this is regardless of whether the cloud service is iaas or paas.
a back-end data service, hosted on virtual machines in an iaas cloud service, can be kept off the public internet but remain accessible to role instances hosted in a front-end paas cloud service. similarly, an iaas cloud service can access the role instances of a paas cloud service without any need for the latter to have (input) endpoints exposed to the internet.
the first example described earlier – a waws front end to a sql server back end – cannot use this technique because a waws website cannot be added to a virtual network. however, the example would work were the front-end website to be hosted by a paas web role located in the same virtual network as the back-end sql server virtual machine. the latter would not need a public endpoint it would only need an appropriately configured firewall. the second example can use this technique, with the node.js cloud service having a public endpoint and the cassandra cluster having no public endpoint.
a very important point is that the virtual network must be created before any cloud services are created in it since once a cloud service has been created it is not possible to migrate it into a virtual network.
michael washam describes this technique in one of the excellent posts on his blog.
creating the virtual network
a virtual network is created using the networks item in the preview windows azure portal. this brings up a wizard which requests the following information:
the virtual networks page requests the following information:
- affinity group
the address space and subnets page requests the following information:
address space (for the network) in the format a.b.c.d/x. for example:
address space for the subnets in the format a.b.c.d/x. for example:
- frontend: 10.10.10.0/24
- backend: 10.10.11.0/24
the dns servers and local networks page can be passed through without providing any information.
once the virtual network has been created, its configuration can be viewed as follows:
adding a virtual machine (iaas cloud service) to the virtual network
an iaas cloud service is added to the virtual network by creating it from the gallery and specifying the appropriate virtual network when asked for the region/affinity group/virtual network . the appropriate subnet is selected on the vm options page in the wizard, as follows:
once the virtual machine has been created, remote desktop can be used to access it. the window firewall with advanced security application can then be used to modify the firewall as needed.
adding a paas cloud service to the virtual network
a paas cloud service is added to a virtual network by adding a networkconfiguration section to its service configuration file. this is located after the end of the role section. for example:
<networkconfiguration> <virtualnetworksite name="samplenetwork" /> <addressassignments> <instanceaddress rolename="contactmanager.web"> <subnets> <subnet name="frontend" /> </subnets> </instanceaddress> </addressassignments> </networkconfiguration>
services on role instances can be exposed to other virtual machines in the virtual network by modifying the firewall on each role instance.
the windows azure virtual network feature, currently in preview, provides the ability for cloud services to interact with each other without exposing services to the public internet. this is a significant enhancement since previously cloud services could not be grouped into composite services without exposing required endpoints to the public internet.
Published at DZone with permission of Neil Mackenzie, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.