How to add a web/worker role to a Virtual Network

Adding a Virtual machine to a Virtual Network is easy because we only have to select the Virtual Network when we are creating the Virtual Machine:

image

But if we want to add a web role or a worker role to a Virtual Network we don´t have a wizard to do that, so we have to do the process manually.

In order to do this process, we have to open ServiceConfiguration.Cloud.cscfg and adding the following xml just below the </Role> tag:

<NetworkConfiguration>
    <VirtualNetworkSite name=”LabVPN” />
         <AddressAssignments>
                <InstanceAddress roleName=”POCworker”>
                   <Subnets>
                          <Subnet name=”Subnet-1″ />
                   </Subnets>
                </InstanceAddress>
         </AddressAssignments>
</NetworkConfiguration>

With this xml we are indicating to Windows Azure that POCWorker has to be added to the Virtual Network called LabVPN and the subnet Subnet-1

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>