从库 [SPFSDK][VMROLE] 创建新的 VM 角色实例

 

适用于:Windows Azure Pack

VM 角色是从 VM 角色库项创建的。 库项提供必须自定义的模板。 然后,创建 VM 角色对象后,该对象将发送到服务管理 API 租户服务,并在其中对其进行验证和处理。

若要从库项创建新的 VM 角色,请执行以下步骤,如下所示:

  1. 获取或创建云服务对象

  2. 获取对 VM 角色库项的引用

  3. 从 VM 角色库项获取资源定义

  4. 收集资源定义参数

  5. 从资源定义参数生成资源配置 JSON 对象

  6. 生成并提交 VM 角色实例 JSON 对象

提示

有关 URL 中使用的占位符的详细信息,请参阅 VM 角色的 URL 备忘单 [SPFSDK][VMROLE]

重要

每当访问云服务中的资源时,都必须追加 api-version=2013-03 查询字符串。 查询字符串始终以 URL 后面的 字符开头。

获取或创建云服务对象

首先,必须获取或创建云服务。 有关详细信息,请参阅创建云服务以托管 VM 角色 [SPFSDK][VMROLE]。 此步骤是必需的,因为每个 VM 角色都托管在云服务中。 仅当想要检索 VM 角色实例或创建新的 VM 角色实例时,才使用云服务。 确定要使用的云服务后,找到充当模板的 VM 角色库项。 使用 VM 角色库项创建 VM 角色。

要实例化的 VM 角色必须提供给当前正在使用的租户订阅。 将 HTTP GET 操作与 库/GalleryItems 集合配合使用。 此集合在 https:// server-nameserver-port/subscription-id/Gallery/GalleryItems/$/MicrosoftCompute.VMRoleGalleryItem?api-version=2013-03 中提供。

HTTP POST 请求

GET https://smapi-server:30006/01274684-6afa-4f3f-b62f-353c6202fed1/Gallery/GalleryItems/$/MicrosoftCompute.VMRoleGalleryItem?api-version=2013-03 HTTP/1.1
x-ms-principal-id: user@domain.com
Accept: application/json
Host: smapi-server:30006
Connection: Keep-Alive

HTTP POST 响应

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 973
Content-Type: application/json; odata=minimalmetadata; streaming=true; charset=utf-8
Content-Language: en-US
Server: Microsoft-IIS/8.5
X-Content-Type-Options: nosniff
DataServiceVersion: 3.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Mon, 16 Sep 2013 22:32:49 GMT

{
    "odata.metadata": "https://spf-server:8090/SC2012R2/VMM/GalleryService.svc/$metadata#GalleryItems/MicrosoftCompute.VMRoleGalleryItem",
    "value": [{
        "ContentUrl": "Gallery/GalleryItems(Name%3d%27CentOS6LAMP%27,Version%3d%271.0.0.0%27,Publisher%3d%27Microsoft%27)/Content",
        "Description": "Deploy a CentOS 6 VM role with Apache, MySQL and PHP installed.",
        "IconUrl": null,
        "Label": "CentOS6 LAMP Role",
        "Name": "CentOS6LAMP",
        "PublishDate": "2013-09-05T18:35:00.967",
        "Publisher": "Microsoft",
        "PublisherLabel": "Microsoft",
        "ResourceDefinition@odata.mediaContentType": "application/json",
        "ResourceDefinitionUrl": "Gallery/GalleryItems(Name%3d%27CentOS6LAMP%27,Version%3d%271.0.0.0%27,Publisher%3d%27Microsoft%27)/MicrosoftCompute.ResourceDefinitionGalleryItem/ResourceDefinition",
        "Version": "1.0.0.0",
        "ViewDefinitionUrl": "Gallery/ViewDefinitions(Name%3d%27CentOS6LAMP%27,Version%3d%271.0.0.0%27,Publisher%3d%27Microsoft%27)/%24value",
        "odata.type": "MicrosoftCompute.VMRoleGalleryItem"
    }]
}

VM 角色库项 MicrosoftCompute.VMRoleGalleryItem 具有名为 ResourceDefinitionUrl 的属性。 此 URL 表示库项的资源定义的位置。 资源定义是创建 VM 角色的新实例时使用的模板。 通常,资源定义包含必须为其提供值的参数列表。 创建实例时,这些参数用于配置 VM 角色。

使用对现有 VM 角色库项的引用,对从 ResourceDefinitionUrl 属性标识的 URL 使用 HTTP GET 操作。 租户 URL 的订阅后追加此 URL:https:// server:30006/subscription-id/ResourceDefinitionUrl?api-version=2013-03。 有关 ResourceDefinition 对象的详细信息,请参阅 ResourceDefinition [SPFSDK][VMROLE]

HTTP POST 请求

GET https://smapi-server:30006/01274684-6afa-4f3f-b62f-353c6202fed1/Gallery/GalleryItems(Name%3d%27CentOS6LAMP%27,Version%3d%271.0.0.0%27,Publisher%3d%27Microsoft%27)/MicrosoftCompute.ResourceDefinitionGalleryItem/ResourceDefinition?api-version=2013-03 HTTP/1.1
x-ms-principal-id: user@domain.com
Accept: application/json
Host: smapi-server:30006

HTTP POST 响应

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 2009
Content-Type: application/json
Content-Language: en-US
Server: Microsoft-IIS/8.5
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 19 Sep 2013 20:00:23 GMT

{
    "IntrinsicSettings": {
        "HardwareProfile": { "VMSize": "[Param.VMRoleVMSize]" },
        "NetworkProfile": { ... removed for brevity ... }
    },
    "Name": "CentOS6LAMP",
    "Publisher": "Microsoft",
    "ResourceExtensionReferences": [{ ... removed for brevity ... }],
    "ResourceParameters": [{
            "Description": "Computer size",
            "Name": "VMRoleVMSize",
            "Type": "String"
        },
        {
            "Description": "Operating system disk",
            "Name": "VMRoleOSVirtualHardDiskImage",
            "Type": "String"
        },
        {
            "Description": "Network reference",
            "Name": "VMRoleNetworkRef",
            "Type": "String"
        },
        {
            "Description": "Resource Extension CentOS6LAMP. Parameter MySQLRootPassword. Run conce command parameter",
            "Name": "CentOS6LAMPMySQLRootPassword",
            "Type": "SecureString"
        },
        {
            "Description": "Compute name pattern",
            "Name": "VMRoleComputerNamePattern",
            "Type": "String"
        },
        {
            "Description": "Time zone",
            "Name": "VMRoleTimeZone",
            "Type": "String"
        },
        {
            "Description": "Administrator credential",
            "Name": "VMRoleAdminCredential",
            "Type": "Credential"
        },
        {
            "Description": "DNS domain name",
            "Name": "VMRoleDNSDomainName",
            "Type": "String"
        },
        {
            "Description": "SSH public key",
            "Name": "VMRoleSSHPublicKey",
            "Type": "String"
        }
    ],
    "SchemaVersion": "1.0",
    "Type": "Microsoft.Compute/VMRole/1.0",
    "Version": "1.0.0.0"
};

收集资源定义参数

每个资源定义可以有一个参数列表,必须为其提供值。 首先,必须检查是否有任何参数。 如果有,请为每个参数提供值,并将生成的列表打包到另一个对象中。 从上一步检索资源定义后,请检查 ResourceParameters 属性。 此属性保存由资源定义定义和使用的参数列表。 此列表可以为空。 如果不是,则必须为每个参数提供一个值。

资源定义参数和提供的值将打包到 JSON 编码的字符串中。 字符串的格式为: { “parameter1 name” : “parameter1 value”, “parameter2 name” : “parameter2 value”, ... }。

"ResourceParameters": [{
        "Description": "Computer size",
        "Name": "VMRoleVMSize",
        "Type": "String"
    },
    {
        "Description": "Operating system disk",
        "Name": "VMRoleOSVirtualHardDiskImage",
        "Type": "String"
    }
]

例如,如果资源定义的参数如前面的代码示例所示,则打包的 JSON 编码字符串可能如下所示。

"{\"VMRoleVMSize\":\"ExtraSmall\",\"VMRoleOSVirtualHardDiskImage\":\"CentOS Linux 6 (64-bit):1.0.0.0\"}"

有关 ResourceParameters 属性的详细信息,请参阅 ResourceDefinition [SPFSDK][VMROLE]

从资源定义参数生成资源配置 JSON 对象

ResourceConfiguration 对象表示用于创建 VM 角色的参数的值。 ResourceConfiguration 对象还包含一个版本字段,表示提供的参数值的版本。 例如,通过使用上一部分的参数值,示例代码显示 ResourceConfiguration 对象。

{
    "Version": "1.0.0.0",
    "ParameterValues": "{\"VMRoleVMSize\":\"ExtraSmall\",\"VMRoleOSVirtualHardDiskImage\":\"CentOS Linux 6 (64-bit):1.0.0.0\"}"
}

有关 ResourceConfiguration 对象的详细信息,请参阅 ResourceConfiguration [SPFSDK][VMROLE]

生成并提交 VM 角色实例 JSON 对象

使用对现有 ResourceDefinition 对象和创建的 ResourceConfiguration 对象的引用,可以创建一个新的 VirtualMachineRole 对象。 然后 ,VirtualMachineRole 对象作为 HTTP POST 操作的正文提交到服务器。 到 POST 的 URL 是 https://server:30006/subscription-id/CloudServices/cloudservice-name/Resources/MicrosoftCompute/VMRoles?api-version=2013-03

以下 JSON 对象是提交到服务器的 VM 角色的示例。 请注意,已提供 ResourceConfigurationResourceDefinitionLabelName 属性。 有关 VirtualMachineRole 对象的详细信息,请参阅 VirtualMachineRole (实例) [SPFSDK][VMROLE]

{
    "InstanceView": null,
    "Label": "Description of the VM Role Instance",
    "Name": "MyVMRole",
    "ProvisioningState": null,
    "ResourceConfiguration": {
        "ParameterValues": "{\"VMRoleVMSize\" : \"ExtraSmall\",\"VMRoleOSVirtualHardDiskImage\" : \"CentOS Linux 6 (64-bit):1.0.0.0\",\"VMRoleNetworkRef\" : \"My VM Network\",\"CentOS6LAMPMySQLRootPassword\" : \"!!pass3abc12\",\"VMRoleComputerNamePattern\" : \"LAMP###\",\"VMRoleTimeZone\" : \"Pacific Standard Time\",\"VMRoleAdminCredential\" : \"root:!!pass3abc12\",\"VMRoleDNSDomainName\" : \"mydns\",\"VMRoleSSHPublicKey\" : \"key123\"}",
        "Version": "1.0.0.0"
    },
    "ResourceDefinition": {
        "IntrinsicSettings": {
            "HardwareProfile": { "VMSize": "[Param.VMRoleVMSize]" },
            "NetworkProfile": {
                "NetworkAdapters": [{
                    "IPAddresses": [{
                        "AllocationMethod": "Dynamic",
                        "ConfigurationName": "IPV4Configuration",
                        "LoadBalancerConfigurations": [],
                        "Type": "IPV4"
                    }],
                    "Name": "NIC1",
                    "NetworkRef": "[Param.VMRoleNetworkRef]"
                }]
            },
            "OperatingSystemProfile": {
                "AdminCredential": "[Param.VMRoleAdminCredential]",
                "ComputerNamePattern": "[Param.VMRoleComputerNamePattern]",
                "LinuxOperatingSystemProfile": {
                    "DNSDomainName": "[Param.VMRoleDNSDomainName]",
                    "SSHPublicKey": "[Param.VMRoleSSHPublicKey]"
                },
                "TimeZone": "[Param.VMRoleTimeZone]",
                "WindowsOperatingSystemProfile": null
            },
            "ScaleOutSettings": {
                "InitialInstanceCount": "1",
                "MaximumInstanceCount": "5",
                "MinimumInstanceCount": "1",
                "UpgradeDomainCount": "1"
            },
            "StorageProfile": {
                "DataVirtualHardDisks": [],
                "OSVirtualHardDiskImage": "[Param.VMRoleOSVirtualHardDiskImage]"
            }
        },
        "Name": "CentOS6LAMP",
        "Publisher": "Microsoft",
        "ResourceExtensionReferences": [{
            "Name": "CentOS6LAMP",
            "Publisher": "Microsoft",
            "ReferenceName": "CentOS6LAMP",
            "ResourceExtensionParameterValues": "{\"MySQLRootPassword\":\"[Param.CentOS6LAMPMySQLRootPassword]\"}",
            "Version": "1.0.0.0"
        }],
        "ResourceParameters": [{
            "Description": "Computer size",
            "Name": "VMRoleVMSize",
            "Type": "String"
        },
            {
                "Description": "Operating system disk",
                "Name": "VMRoleOSVirtualHardDiskImage",
                "Type": "String"
            },
            {
                "Description": "Network reference",
                "Name": "VMRoleNetworkRef",
                "Type": "String"
            },
            {
                "Description": "Resource Extension CentOS6LAMP. Parameter MySQLRootPassword. Run conce command parameter",
                "Name": "CentOS6LAMPMySQLRootPassword",
                "Type": "SecureString"
            },
            {
                "Description": "Compute name pattern",
                "Name": "VMRoleComputerNamePattern",
                "Type": "String"
            },
            {
                "Description": "Time zone",
                "Name": "VMRoleTimeZone",
                "Type": "String"
            },
            {
                "Description": "Administrator credential",
                "Name": "VMRoleAdminCredential",
                "Type": "Credential"
            },
            {
                "Description": "DNS domain name",
                "Name": "VMRoleDNSDomainName",
                "Type": "String"
            },
            {
                "Description": "SSH public key",
                "Name": "VMRoleSSHPublicKey",
                "Type": "String"
            }
        ],
        "SchemaVersion": "1.0",
        "Type": "Microsoft.Compute/VMRole/1.0",
        "Version": "1.0.0.0"
    },
    "Substate": null
}

HTTP POST 请求

POST https://smapi-server:30006/01274684-6afa-4f3f-b62f-353c6202fed1/CloudServices/TestVM/Resources/MicrosoftCompute/VMRoles?api-version=2013-03 HTTP/1.1
x-ms-principal-id: user@domain.com
Accept: application/json
Content-Type: application/json
Host: smapi-server:30006
Content-Length: 2676
Expect: 100-continue
Connection: Keep-Alive

{"InstanceView":null,"Label":"Description Value Here","Name":"ExampleVMRole","ProvisioningState":null,"ResourceConfiguration":{"ParameterValues":"{\"VMRoleVMSize\" : \"ExtraSmall\",\"VMRoleOSVirtualHardDiskImage\" : \"CentOS Linux 6 (64-bit):1.0.0.0\",\"VMRoleNetworkRef\" : \"My VM Network\",\"CentOS6LAMPMySQLRootPassword\" : \"!!pass3abc12\",\"VMRoleComputerNamePattern\" : \"LAMP###\",\"VMRoleTimeZone\" : \"Pacific Standard Time\",\"VMRoleAdminCredential\" : \"root:!!pass3abc12\",\"VMRoleDNSDomainName\" : \"mydns\",\"VMRoleSSHPublicKey\" : \"andy\"}","Version":"1.0.0.0"},"ResourceDefinition":{"IntrinsicSettings":{"HardwareProfile":{"VMSize":"[Param.VMRoleVMSize]"},"NetworkProfile":{"NetworkAdapters":[{"IPAddresses":[{"AllocationMethod":"Dynamic","ConfigurationName":"IPV4Configuration","LoadBalancerConfigurations":[],"Type":"IPV4"}],"Name":"NIC1","NetworkRef":"[Param.VMRoleNetworkRef]"}]},"OperatingSystemProfile":{"AdminCredential":"[Param.VMRoleAdminCredential]","ComputerNamePattern":"[Param.VMRoleComputerNamePattern]","LinuxOperatingSystemProfile":{"DNSDomainName":"[Param.VMRoleDNSDomainName]","SSHPublicKey":"[Param.VMRoleSSHPublicKey]"},"TimeZone":"[Param.VMRoleTimeZone]","WindowsOperatingSystemProfile":null},"ScaleOutSettings":{"InitialInstanceCount":"1","MaximumInstanceCount":"5","MinimumInstanceCount":"1","UpgradeDomainCount":"1"},"StorageProfile":{"DataVirtualHardDisks":[],"OSVirtualHardDiskImage":"[Param.VMRoleOSVirtualHardDiskImage]"}},"Name":"CentOS6LAMP","Publisher":"Microsoft","ResourceExtensionReferences":[{"Name":"CentOS6LAMP","Publisher":"Microsoft","ReferenceName":"CentOS6LAMP","ResourceExtensionParameterValues":"{\"MySQLRootPassword\":\"[Param.CentOS6LAMPMySQLRootPassword]\"}","Version":"1.0.0.0"}],"ResourceParameters":[{"Description":"Computer size","Name":"VMRoleVMSize","Type":"String"},{"Description":"Operating system disk","Name":"VMRoleOSVirtualHardDiskImage","Type":"String"},{"Description":"Network reference","Name":"VMRoleNetworkRef","Type":"String"},{"Description":"Resource Extension CentOS6LAMP. Parameter MySQLRootPassword. Run conce command parameter","Name":"CentOS6LAMPMySQLRootPassword","Type":"SecureString"},{"Description":"Compute name pattern","Name":"VMRoleComputerNamePattern","Type":"String"},{"Description":"Time zone","Name":"VMRoleTimeZone","Type":"String"},{"Description":"Administrator credential","Name":"VMRoleAdminCredential","Type":"Credential"},{"Description":"DNS domain name","Name":"VMRoleDNSDomainName","Type":"String"},{"Description":"SSH public key","Name":"VMRoleSSHPublicKey","Type":"String"}],"SchemaVersion":"1.0","Type":"Microsoft.Compute\/VMRole\/1.0","Version":"1.0.0.0"},"Substate":null}

HTTP POST 响应

HTTP/1.1 201 Created
Cache-Control: no-cache
Content-Length: 4839
Content-Type: application/json; odata=minimalmetadata; streaming=true; charset=utf-8
Location: https://spf-server:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/VMRole/ExampleVMRole
Server: Microsoft-IIS/8.5
x-ms-request-id: 01095ac2-df63-4930-8782-691a8c365319
X-Content-Type-Options: nosniff
request-id: 68d9b05b-a9da-0000-2f56-de68daa9ce01
DataServiceVersion: 3.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 19 Sep 2013 22:17:57 GMT

{"odata.metadata":"https://spf-server:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/$metadata#VMRole/@Element","Name":"ExampleVMRole","Label":"Description Value Here","ResourceDefinition":{"Name":"CentOS6LAMP","Version":"1.0.0.0","Publisher":"Microsoft","SchemaVersion":"1.0","Type":"Microsoft.Compute/VMRole/1.0","ResourceParameters":[{"Name":"VMRoleVMSize","Type":"String","Description":"Computer size"},{"Name":"VMRoleOSVirtualHardDiskImage","Type":"String","Description":"Operating system disk"},{"Name":"VMRoleNetworkRef","Type":"String","Description":"Network reference"},{"Name":"CentOS6LAMPMySQLRootPassword","Type":"SecureString","Description":"Resource Extension CentOS6LAMP. Parameter MySQLRootPassword. Run conce command parameter"},{"Name":"VMRoleComputerNamePattern","Type":"String","Description":"Compute name pattern"},{"Name":"VMRoleTimeZone","Type":"String","Description":"Time zone"},{"Name":"VMRoleAdminCredential","Type":"Credential","Description":"Administrator credential"},{"Name":"VMRoleDNSDomainName","Type":"String","Description":"DNS domain name"},{"Name":"VMRoleSSHPublicKey","Type":"String","Description":"SSH public key"}],"ResourceExtensionReferences":[{"ReferenceName":"CentOS6LAMP","Name":"CentOS6LAMP","Version":"1.0.0.0","Publisher":"Microsoft","ResourceExtensionParameterValues":"{\"MySQLRootPassword\":\"[Param.CentOS6LAMPMySQLRootPassword]\"}"}],"IntrinsicSettings":{"ScaleOutSettings":{"InitialInstanceCount":"1","MaximumInstanceCount":"5","MinimumInstanceCount":"1","UpgradeDomainCount":"1"},"HardwareProfile":{"VMSize":"[Param.VMRoleVMSize]"},"StorageProfile":{"OSVirtualHardDiskImage":"[Param.VMRoleOSVirtualHardDiskImage]","DataVirtualHardDisks":[]},"OperatingSystemProfile":{"ComputerNamePattern":"[Param.VMRoleComputerNamePattern]","TimeZone":"[Param.VMRoleTimeZone]","AdminCredential":"[Param.VMRoleAdminCredential]","WindowsOperatingSystemProfile":{"WorkgroupName":null,"DomainJoin":null},"LinuxOperatingSystemProfile":{"DNSDomainName":"[Param.VMRoleDNSDomainName]","SSHPublicKey":"[Param.VMRoleSSHPublicKey]"}},"NetworkProfile":{"NetworkAdapters":[{"Name":"NIC1","NetworkRef":"[Param.VMRoleNetworkRef]","IPAddresses":[{"AllocationMethod":"Dynamic","Type":"IPV4","ConfigurationName":"IPV4Configuration","LoadBalancerConfigurations":[]}]}]}}},"ResourceConfiguration":{"Version":"1.0.0.0","ParameterValues":"{\"VMRoleVMSize\":\"ExtraSmall\",\"VMRoleOSVirtualHardDiskImage\":\"CentOS Linux 6 (64-bit):1.0.0.0\",\"VMRoleNetworkRef\":\"My VM Network\",\"CentOS6LAMPMySQLRootPassword\":\"__**__\",\"VMRoleComputerNamePattern\":\"LAMP###\",\"VMRoleTimeZone\":\"Pacific Standard Time\",\"VMRoleAdminCredential\":\"root:__**__\",\"VMRoleDNSDomainName\":\"mydns\",\"VMRoleSSHPublicKey\":\"andy\"}"},"ProvisioningState":"Provisioning","Substate":{"VMRoleMessages":[]},"InstanceView":{"VIPs":[],"InstanceCount":"0","ResolvedResourceDefinition":{"Name":"CentOS6LAMP","Version":"1.0.0.0","Publisher":"Microsoft","SchemaVersion":"1.0","Type":"Microsoft.Compute/VMRole/1.0","ResourceParameters":[{"Name":"VMRoleVMSize","Type":"String","Description":"Computer size"},{"Name":"VMRoleOSVirtualHardDiskImage","Type":"String","Description":"Operating system disk"},{"Name":"VMRoleNetworkRef","Type":"String","Description":"Network reference"},{"Name":"CentOS6LAMPMySQLRootPassword","Type":"SecureString","Description":"Resource Extension CentOS6LAMP. Parameter MySQLRootPassword. Run conce command parameter"},{"Name":"VMRoleComputerNamePattern","Type":"String","Description":"Compute name pattern"},{"Name":"VMRoleTimeZone","Type":"String","Description":"Time zone"},{"Name":"VMRoleAdminCredential","Type":"Credential","Description":"Administrator credential"},{"Name":"VMRoleDNSDomainName","Type":"String","Description":"DNS domain name"},{"Name":"VMRoleSSHPublicKey","Type":"String","Description":"SSH public key"}],"ResourceExtensionReferences":[{"ReferenceName":"CentOS6LAMP","Name":"CentOS6LAMP","Version":"1.0.0.0","Publisher":"Microsoft","ResourceExtensionParameterValues":"{\"MySQLRootPassword\":\"__**__\"}"}],"IntrinsicSettings":{"ScaleOutSettings":{"InitialInstanceCount":"1","MaximumInstanceCount":"5","MinimumInstanceCount":"1","UpgradeDomainCount":"1"},"HardwareProfile":{"VMSize":"ExtraSmall"},"StorageProfile":{"OSVirtualHardDiskImage":"CentOS Linux 6 (64-bit):1.0.0.0","DataVirtualHardDisks":[]},"OperatingSystemProfile":{"ComputerNamePattern":"LAMP###","TimeZone":"Pacific Standard Time","AdminCredential":"root:__**__","WindowsOperatingSystemProfile":{"WorkgroupName":null,"DomainJoin":null},"LinuxOperatingSystemProfile":{"DNSDomainName":"mydns","SSHPublicKey":"andy"}},"NetworkProfile":{"NetworkAdapters":[{"Name":"NIC1","NetworkRef":"My VM Network","IPAddresses":[{"AllocationMethod":"Dynamic","Type":"IPV4","ConfigurationName":"IPV4Configuration","LoadBalancerConfigurations":[]}]}]}}}}}

另请参阅

预配 VM 角色 [SPFSDK][VMROLE]
创建云服务以托管 VM 角色 [SPFSDK][VMROLE]
检查 VM 角色是否有预配错误 [SPFSDK][VMROLE]