简体   繁体   English

使用Node SDK从映像创建Azure虚拟机

[英]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.

相关问题 如何使用 nodejs azure SDK 启动具有 azure VM 映像的新 VM? - How to launch a new VM with azure VM image using nodejs azure SDK? 使用Azure VM Javascript SDK从RunCommand获取StdOut - Get StdOut from RunCommand using Azure VM Javascript SDK 从带有 MSI 的 linux vm 使用节点从 azure keyvault 获取秘密 - Getting a secret from azure keyvault with node from a linux vm with MSI Azure使用节点js Sdk创建虚拟机 - Azure creating virtual machine using node js Sdk 在VPN Azure上将节点VM连接到SQL VM - Connecting Node VM to SQL VM on VPN Azure 如何使用Azure节点sdk创建具有Azure专用ACR映像的容器 - how to use Azure node sdk to create a container with azure private ACR image 如何从在Azure中的VM上运行的Node.JS应用程序中获取ILPIP(PIP)? - How do get ILPIP (PIP) from within a Node.JS application running ona VM in Azure? 从另一个Azure VM连接到Azure VM上的mongodb - Connect to mongodb on Azure VM from another Azure VM 从Azure VM将文件上传到Azure存储 - Upload files to Azure Storage from Azure VM 反序列化从 node.js (azure sdk) 发送的 Azure ServiceBus 队列消息时出错 - Error while deserializing Azure ServiceBus Queue message sent from node.js (azure sdk)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM