Deploying a Cloud Service to a VNet

In a recent post about Microsoft Azure Virtual Networks, I made the recommendation that Cloud Services should be deployed to Microsoft Azure Virtual Networks. The driving factor behind this recommendation comes from my personal real-world experience, where I learned the hard way, that moving a deployed Cloud Service to a Virtual Network meant downtime…

Getting it Done

In order to deploy a Cloud Service to a Virtual Network, we must add Network Configuration section to the Service Configuration file. The following is the updated ServiceConfiguration.Cloud.cscfg that specified that my Cloud Service is to be deployed to my Virtual Network called AzureVNet and more specifically to its Subnet called MiddleTier.

<?xml version="1.0" encoding="utf-16"?>
<ServiceConfiguration xmlns:xsd="" xmlns:xsi="" serviceName="briseboisDemo3" osFamily="4" osVersion="*" xmlns="">

  <Role name="Compute">
    <Instances count="5" />

    <!-- Name of the target Virtual Network -->
    <VirtualNetworkSite name="AzureVNet" />

    <!-- Associating a Role to a Specific Subnet by name -->
      <InstanceAddress roleName="Compute">
          <Subnet name="MiddleTier" />

Looking at these configuration updates, you may be asking whether we have to do anything else to successfully deploy to a Virtual Network. The answer is no, there is nothing more to it. Fire up PowerShell or your favorite tool to deploy your updated Cloud Service package to Azure.

I used the following Network Configuration to create my test Virtual Network.

<?xml version="1.0" encoding="utf-8"?>
<NetworkConfiguration xmlns:xsd="" xmlns:xsi="" xmlns="">
    <Dns />
      <VirtualNetworkSite name="AzureVNet" Location="East US 2">
          <Subnet name="MiddleTier">

4 responses to Deploying a Cloud Services to A Virtual Network (VNet) on #Azure


    Thanks Q



    Hi Alexandre,
    thanks a lot for the sharing and globaly for the quality of the information you provide through this blog.
    i am currently try a proof of concept on how to deploy a Cloud service into a Vnet in order to address security issues. my question is to know once the cloud lives in a VNET is it still possible to deploy it from releaser manager ? like any paas resources ? any link or shared resource will be greatly appreciate.



    Hi Alexandre,
    So what do you do if you want to have separate deployments to QA and Production environments? You can’t hard-code the network name, because QA and Prod will be on different networks…


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.