Azure 云服务的配置 NetworkConfiguration 架构Azure Cloud Services Config NetworkConfiguration Schema

服务配置文件的 NetworkConfiguration 元素指定虚拟网络和 DNS 值。The NetworkConfiguration element of the service configuration file specifies Virtual Network and DNS values. 对于云服务,这些设置是可选的。These settings are optional for cloud services.

可以通过以下资源深入了解虚拟网络和关联的架构:You can use the following resource to learn more about Virtual Networks and the associated schemas:

NetworkConfiguration 元素NetworkConfiguration Element

下面的示例演示 NetworkConfiguration 元素及其子元素。The following example shows the NetworkConfiguration element and its child elements.

<ServiceConfiguration>
  <NetworkConfiguration>
    <AccessControls>
      <AccessControl name="aclName1">
        <Rule order="<rule-order>" action="<rule-action>" remoteSubnet="<subnet-address>" description="rule-description"/>
      </AccessControl>
    </AccessControls>
    <EndpointAcls>
      <EndpointAcl role="<role-name>" endpoint="<endpoint-name>" accessControl="<acl-name>"/>
    </EndpointAcls>
    <Dns>
      <DnsServers>
        <DnsServer name="<server-name>" IPAddress="<server-address>" />
      </DnsServers>
    </Dns>
    <VirtualNetworkSite name="Group <RG-VNet> <VNet-name>"/>
    <AddressAssignments>
      <InstanceAddress roleName="<role-name>">
        <Subnets>
          <Subnet name="<subnet-name>"/>
        </Subnets>
      </InstanceAddress>
      <ReservedIPs>
        <ReservedIP name="<reserved-ip-name>"/>
      </ReservedIPs>
    </AddressAssignments>
  </NetworkConfiguration>
</ServiceConfiguration>

下表介绍了 NetworkConfiguration 元素的子元素。The following table describes the child elements of the NetworkConfiguration element.

元素Element 说明Description
AccessControlAccessControl 可选。Optional. 指定云服务中用于访问终结点的规则。Specifies the rules for access to endpoints in a cloud service. 访问控制名称由 name 属性的字符串定义。The access control name is defined by a string for name attribute. AccessControl 元素包含一个或多个 Rule 元素。The AccessControl element contains one or more Rule elements. 可定义多个 AccessControl 元素。More than one AccessControl element can be defined.
规则Rule 可选。Optional. 指定应对指定的 IP 地址子网范围执行的操作。Specifies the action that should be taken for a specified subnet range of IP addresses. 规则的顺序由 order 属性的字符串值定义。The order of the rule is defined by a string value for the order attribute. 规则编号越低,优先级越高。The lower the rule number the higher the priority. 例如,可使用序号 100、200 和 300 指定规则。For example, rules could be specified with order numbers of 100, 200, and 300. 序号为 100 的规则优先于序号为 200 的规则。The rule with the order number of 100 takes precedence over the rule that has an order of 200.

规则的操作由 action 属性的字符串定义。The action for the rule is defined by a string for the action attribute. 可能的值包括:Possible values are:

- permit – 指定只有指定子网范围中的数据包才可以与终结点通信。- permit – Specifies that only packets from the specified subnet range can communicate with the endpoint.
- deny – 指定拒绝对指定子网范围中终结点的访问。- deny – Specifies that access is denied to the endpoints in the specified subnet range.

受规则影响的 IP 地址的子网范围由 remoteSubnet 属性的字符串定义。The subnet range of IP addresses that are affected by the rule are defined by a string for the remoteSubnet attribute. 对规则的说明由 description 属性的字符串定义。The description for the rule is defined by a string for the description attribute.
EndpointAclEndpointAcl 可选。Optional. 指定向终结点分配访问控制规则。Specifies the assignment of access control rules to an endpoint. 包含终结点的角色的名称由 role 属性的字符串定义。The name of the role that contains the endpoint is defined by a string for the role attribute. 终结点的名称由 endpoint 属性的字符串定义。The name of the endpoint is defined by a string for the endpoint attribute. 对于应该应用到终结点的 AccessControl 规则的集合,其名称在 accessControl 属性的字符串中定义。The name of the set of AccessControl rules that should be applied to the endpoint are defined in a string for the accessControl attribute. 可定义多个 EndpointAcl 元素。More than one EndpointAcl elements can be defined.
DnsServerDnsServer 可选。Optional. 指定 DNS 服务器的设置。Specifies the settings for a DNS server. 可以指定不使用虚拟网络的 DNS 服务器的设置。You can specify settings for DNS servers without a Virtual Network. DNS 服务器的名称由 name 属性的字符串定义。The name of the DNS server is defined by a string for the name attribute. DNS 服务器的 IP 地址由 IPAddress 属性的字符串定义。The IP address of the DNS server is defined by a string for the IPAddress attribute. 该 IP 地址必须是有效的 IPv4 地址。The IP address must be a valid IPv4 address.
VirtualNetworkSiteVirtualNetworkSite 可选。Optional. 指定要在其中部署云服务的虚拟网络站点的名称。Specifies the name of the Virtual Network site in which you want deploy your cloud service. 此设置不会创建虚拟网络站点。This setting does not create a Virtual Network Site. 它引用之前已在虚拟网络的网络文件中定义的站点。It references a site that has been previously defined in the network file for your Virtual Network. 一个云服务只能是一个虚拟网络的成员。A cloud service can only be a member of one Virtual Network. 如未指定此设置,则云服务不会部署到虚拟网络。If you do not specify this setting, the cloud service will not be deployed to a Virtual Network. 虚拟网络站点的名称由 name 属性的字符串定义。The name of the Virtual Network site is defined by a string for the name attribute.
InstanceAddressInstanceAddress 可选。Optional. 指定角色与虚拟网络中的子网或子网集的关联。Specifies the association of a role to a subnet or set of subnets in the Virtual Network. 将角色名称关联到实例地址时,可以指定要将此角色与之关联的子网。When you associate a role name to an instance address, you can specify the subnets to which you want this role to be associated. InstanceAddress 包含 Subnets 元素。The InstanceAddress contains a Subnets element. 与一个或多个子网相关联的角色的名称由 roleName 属性的字符串定义。The name of the role that is associated with the subnet or subnets is defined by a string for the roleName attribute.
子网Subnet 可选。Optional. 指定与网络配置文件中的子网名称相对应的子网。Specifies the subnet that corresponds to the subnet name in the network configuration file. 子网的名称由 name 属性的字符串定义。The name of the subnet is defined by a string for the name attribute.
ReservedIPReservedIP 可选。Optional. 指定应与部署关联的保留 IP 地址。Specifies the reserved IP address that should be associated with the deployment. 必须使用“创建保留 IP 地址”创建保留的 IP 地址。You must use Create Reserved IP Address to create the reserved IP address. 云服务中的每个部署均可与一个保留 IP 地址相关联。Each deployment in a cloud service can be associated with one reserved IP address. 保留 IP 地址的名称由 name 属性的字符串定义。The name of the reserved IP address is defined by a string for the name attribute.

另请参阅See Also

云服务(经典)配置架构Cloud Service (classic) Configuration Schema