Azure 云服务配置角色架构Azure Cloud Services Config Role Schema

配置文件的 Role 元素指定要为服务中的每个角色部署的角色实例数,任何配置设置的值,以及与角色关联的任何证书的缩略图。The Role element of the configuration file specifies the number of role instances to deploy for each role in the service, the values of any configuration settings, and the thumbprints for any certificates associated with a role.

有关 Azure 服务配置架构的详细信息,请参阅云服务(经典)配置架构For more information about the Azure Service Configuration Schema, see Cloud Service (classic) Configuration Schema. 有关 Azure 服务定义架构的详细信息,请参阅云服务(经典)定义架构For more information about the Azure Service Definition Schema, see Cloud Service (classic) Definition Schema.

Role 元素Role Element

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

<ServiceConfiguration>
  <Role name="<role-name>" vmName="<vm-name>">
    <Instances count="<number-of-instances>"/>
    <ConfigurationSettings>
      <Setting name="<setting-name>" value="<setting-value>" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="<certificate-name>" thumbprint="<certificate-thumbprint>" thumbprintAlgorithm="<algorithm>"/>
    </Certificates>
  </Role>
</ServiceConfiguration>

下表介绍了 Role 元素的属性。The following table describes the attributes for the Role element.

属性Attribute 说明Description
namename 必需。Required. 指定角色的名称。Specifies the name of the role. 该名称必须与在服务定义文件中为角色提供的名称匹配。The name must match the name provided for the role in the service definition file.
vmNamevmName 可选。Optional. 指定虚拟机的 DNS 名称。Specifies the DNS name for a Virtual Machine. 该名称不能超过 10 个字符。The name must be 10 characters or less.

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

元素Element 说明Description
InstancesInstances 必需。Required. 指定要为角色部署的实例数。Specifies the number of instances to deploy for the role. 实例数是由用于 count 属性的整数定义的。The number of instances is defined by an integer for the count attribute.
设置Setting 可选。Optional. 在角色的设置集合中指定设置名称和值。Specifies a setting name and value in a collection of settings for a role. 设置名称是由用于 name 属性的字符串定义的,设置值是由用于 value 属性的字符串定义的。The setting name is defined by a string for the name attribute and the setting value is defined by a string for the value attribute.
证书Certificate 可选。Optional. 指定要与角色关联的服务证书的名称、指纹和算法。Specifies the name, thumbprint, and algorithm of a service certificate that is to be associated with the role. 证书名称是由用于 name 属性的字符串定义的。The certificate name is defined by a string for the name attribute. 证书指纹是由用于 thumbprint 属性的一串不含空格的十六进制数字定义的。The certificate thumbprint is defined by a string of hexadecimal numbers containing no spaces for the thumbprint attribute. 必须使用数字和大写字母字符来表示十六进制数字。The hexadecimal numbers must be represented using digits and uppercase alpha characters. 证书算法是由用于 thumbprintAlgorithm 属性的字符串定义的。The certificate algorithm is defined by a string for the thumbprintAlgorithm attribute.

另请参阅See Also

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