[英]Creating azure VM from image with Node SDK
I'm trying to use the azure sdk ( azure-sdk-for-node ) to create a virtual machine based on an image i've already saved. 我正在尝试使用azure sdk( azure-sdk-for-node )基于已经保存的图像创建虚拟机。 I've also already created the service.
我也已经创建了服务。
Here is what I've got: 这是我所拥有的:
// 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);
}
});
And the error I'm getting is this. 我得到的错误是这个。 I follow the example in the github readme almost exactly.
我几乎完全按照github自述文件中的示例进行操作。 Not sure why this is an issue.
不知道为什么这是一个问题。
{ [Error: A computer name must be specified.]
code: 'BadRequest',
statusCode: 400,
requestId: '9206ea1e591eb4dd8ea21a9196da5d74' }
Thanks! 谢谢!
It turns out that the error message is inaccurate. 原来,错误消息不正确。 When deploying a Linux instance, only the "HostName" is required when defining the Configuration Set.
部署Linux实例时,定义配置集时仅需要“ HostName”。 "ComputerName" applies only to Windows instances.
“计算机名”仅适用于Windows实例。 Here's an example of C# code:
这是C#代码的示例:
ConfigurationSet configSet = new ConfigurationSet
{
HostName = "VMTest",
UserName="xxxxx",
UserPassword="xxxx",
ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.