从节点SDK图像创建VM蔚蓝 [英] Creating azure VM from image with Node SDK

查看:117
本文介绍了从节点SDK图像创建VM蔚蓝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用蔚蓝色的SDK(<一个href=\"https://github.com/Azure/azure-sdk-for-node/blob/master/lib/services/computeManagement/README.md\"相对=nofollow> Azure的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. I've also already created the service.

下面是我得到了什么:

// 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的自述几乎一模一样。不知道为什么这是一个问题。

And the error I'm getting is this. I follow the example in the github readme almost exactly. Not sure why this is an issue.

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

谢谢!

推荐答案

原来,该错误信息是不准确的。在部署Linux实例,只有主机名定义的配置设置时,需要。 计算机名仅适用于Windows实例。下面是C#code的例子:

It turns out that the error message is inaccurate. When deploying a Linux instance, only the "HostName" is required when defining the Configuration Set. "ComputerName" applies only to Windows instances. Here's an example of C# code:

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

这篇关于从节点SDK图像创建VM蔚蓝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆