在子网上部署Azure云服务

时间:2017-01-19 13:07:21

标签: azure-cloud-services azure-virtual-network

我想在子网上部署Cloud Service。

为此,我设置了如下配置文件:

<?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>

但是,在部署之后,如果我查看Azure门户上的子网,我就不会看到Cloud Service:

enter image description here

我应该做点什么吗?

1 个答案:

答案 0 :(得分:1)

根据您的说明,我按照此官方tutorial部分的说明将您的Cloud Service添加到虚拟网络。以下是一些细节,您可以参考它们。

修改ServiceConfiguration.Cloud.cscfg,在ServiceConfiguration下添加NetworkConfiguration,如下所示:

<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>

注意: VNet和子网必须是经典虚拟网络资源,而不是Azure资源管理器资源。

构建并将其部署到Azure后,您可以通过classical Azure Portal在VNet下找到CloudService资源,如下所示: