使用Node SDK从图像创buildazure色虚拟机

我正尝试使用azure sdk( azure-sdk-for-node )创build一个基于我已经保存的映像的虚拟机。 我也已经创build了这个服务。

这是我得到的:

// Create a virtual machine in the cloud service. computeManagementClient.virtualMachines.createDeployment('prerender-pro', { name: "prerender-pro", deploymentSlot: "Production", label: "for heavy duty caching", roles: [{ roleName: "prerender-pro", roleType: "PersistentVMRole", label: "for heavy duty caching", oSVirtualHardDisk: { sourceImageName: "prerender-os-2014-07-16", mediaLink: "https://XXXXXXX.blob.core.windows.net/vhds/prerender-os-2014-07-16.vhd" }, dataVirtualHardDisks: [], configurationSets: [{ configurationSetType: "LinuxProvisioningConfiguration", adminUserName: "Blah", adminPassword: "Blahblah2014!", computerName: 'prerender-pro', enableAutomaticUpdates: true, resetPasswordOnFirstLogon: false, storedCertificateSettings: [], inputEndpoints: [] }, { configurationSetType: "NetworkConfiguration", subnetNames: [], storedCertificateSettings: [], inputEndpoints: [{ localPort: 3389, protocol: "tcp", name: "RemoteDesktop" }] }] }] }, function (err, result) { if (err) { console.error(err); } else { console.info(result); } }); 

而我得到的错误是这样的。 我几乎完全遵循github自述文件中的示例。 不知道为什么这是一个问题。

 { [Error: A computer name must be specified.] code: 'BadRequest', statusCode: 400, requestId: '9206ea1e591eb4dd8ea21a9196da5d74' } 

谢谢!

原来,错误信息是不准确的。 在部署Linux实例时,定义configuration集时只需要“主机名”。 “ComputerName”仅适用于Windows实例。 这是一个C#代码的例子:

 ConfigurationSet configSet = new ConfigurationSet { HostName = "VMTest", UserName="xxxxx", UserPassword="xxxx", ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration }