1
votes

I want to deploy a Cloud Service on a subnet.

To do this, I have set the configuration file like this :

<?xml version="1.0" encoding="utf-8"?>
  <ServiceConfiguration ...>
    <Role name="WebRole1">
    ...
    </Role>
    <NetworkConfiguration>
       <VirtualNetworkSite name="MyVirtualNetworkName" />
       <AddressAssignments>
         <InstanceAddress roleName="WebRole1">
            <Subnets>
             <Subnet name="Front" />
            </Subnets>
          </InstanceAddress>
       </AddressAssignments>
    </NetworkConfiguration>
</ServiceConfiguration>

But, after the deployment, if I look the subnet on the Azure Portal, I don't see the Cloud Service :

enter image description here

Should I do something else?

1

1 Answers

2
votes

According to your description, I followed the section int this official tutorial about adding your Cloud Service to the Virtual Network. Here are some details, you could refer to them.

Modify ServiceConfiguration.Cloud.cscfg by adding NetworkConfiguration under ServiceConfiguration as follows:

<ServiceConfiguration serviceName="AzureCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="5" osVersion="*" schemaVersion="2015-04.2.6">
  <Role name="MyWebRole">
    <Instances count="1" />
    <ConfigurationSettings>
      ...
    </ConfigurationSettings>
  </Role>

  <NetworkConfiguration>
    <!--VNet settings
      VNet and subnet must be classic virtual network resources, not Azure Resource Manager resources.-->
    <VirtualNetworkSite name="bruce-vnet-eastasia" />
    <AddressAssignments>
      <InstanceAddress roleName="MyWebRole">
        <Subnets>
          <Subnet name="Subnet-1" />
        </Subnets>
      </InstanceAddress>
    </AddressAssignments>
    <!--VNet settings-->
  </NetworkConfiguration>
</ServiceConfiguration>

Note: VNet and subnet must be classic virtual network resources, not Azure Resource Manager resources.

After build and deploy it to Azure, you could find the CloudService resource under your VNet via the classical Azure Portal as follows: