azure-xplat-cli icon indicating copy to clipboard operation
azure-xplat-cli copied to clipboard

Cannot create VM using Azure CLI

Open esakkiraj opened this issue 9 years ago • 6 comments

CLI Version: 0.9.17 OSType: Mac OSX 10.9.4 Installation via: npm Mode: ASM

Cannot create Window Server VM using azure vm create.

Command executed: azure vm create -z "Standard_DS1" -w "testnetwork1" -l "Southeast Asia" -e 22 -R "MyReservedIP5" mywin1 a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20151120-en.us-127GB.vhd testuser testwindows123@

Error stack trace:

2016-03-22T07:06:07.608Z: { [Error: Deployment mywin1 uses ReservedIP MyReservedIP5 but does not contain any endpoints. Deployment must contain at least one endpoint in order to use a ReservedIP.] code: 'BadRequest', statusCode: 400, requestId: '03efb099250a80f3a1da4e9f4d2a0e51' } Error: Deployment mywin1 uses ReservedIP MyReservedIP5 but does not contain any endpoints. Deployment must contain at least one endpoint in order to use a ReservedIP. at Function.ServiceClient._normalizeError (/usr/local/lib/node_modules/azure-cli/node_modules/azure-common/lib/services/serviceclient.js:815:23) at /usr/local/lib/node_modules/azure-cli/node_modules/azure-common/lib/services/filters/errorhandlingfilter.js:44:29 at Request._callback (/usr/local/lib/node_modules/azure-cli/node_modules/azure-common/lib/http/request-pipeline.js:109:14) at Request.self.callback (/usr/local/lib/node_modules/azure-cli/node_modules/azure-common/node_modules/request/request.js:199:22) at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request. (/usr/local/lib/node_modules/azure-cli/node_modules/azure-common/node_modules/request/request.js:1160:14) at emitOne (events.js:82:20) at Request.emit (events.js:169:7) at IncomingMessage. (/usr/local/lib/node_modules/azure-cli/node_modules/azure-common/node_modules/request/request.js:1111:12)

Also tried providing -e option but still getting the same error. #1461

esakkiraj avatar Mar 22 '16 07:03 esakkiraj

@huangpf , @sauryadas - Can you take a look at this issue. Similar issues #1461, #1922 have been posted by customers. Can you please respond to all of these issues.

amarzavery avatar Mar 25 '16 00:03 amarzavery

The reserved IP (& other networking related) features had been transferred to the networking team. So they would need to help take a look. @amarzavery

huangpf avatar Mar 25 '16 00:03 huangpf

@romangromov - As per @huangpf 's comment, networking related issues while creating a vm need to be handled by the networking team. So can you please take a look at this issue #1461 and #1922 ? @eduardkoller - Tagging you for visibility.

amarzavery avatar Apr 20 '16 22:04 amarzavery

adding @MikhailTryakhov for the same.

@amarzavery @huangpf this issue is about SSH/RDP endpoint for VM, but not related to reserved-ip itself. The reserved-ip is attached to VM and sending over the wire while creating deployment, but SSH/RDP endpoint not - that is the problem of reported issues.

romangromov avatar Apr 21 '16 08:04 romangromov

@romangromov @huangpf So which teams needs to fix this issue?

sauryadas avatar Apr 29 '16 02:04 sauryadas

@huangpf @sauryadas - /cc @eduardkoller It took me some time to debug through the cli code, look at the hydra-specs and the MSDN REST API specs to find out the underlying issue.

So @esakkiraj is creating a Windows VM with a reservedIP. This setup needs at least one endpoint as rightly suggested by the service in the error message.

since, the user is creating a Windows VM, he must provide the -r 3389 rdp port as an endpoint and not the -e 22 ssh endpoint.

The CLI source code configures ssh endpoint for linux vms and rdp endpoint for windows vms.

Questions to be answered by the Compute team:

  • I don't know why the CLI does not configure an ssh endpoint for a Windows VM. Is this not allowed by the service or is a bug in the CLI?
  • Should the CLI throw an error or a warning and let the user know that the ssh endpoint will be ignored for Windows VM.?
  • Should this be mentioned in the help, to guide the user to do the right thing?

After passing the rdp port as an endpoint the above command executed successfully.

The request payload sent to the service for creating deployment is as follows: POST: https://management.core.windows.net/{sub-id}/services/hostedservices/samplewinVM/deployments

<?xml version="1.0" encoding="UTF-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsazure">
   <Name>samplewinVM</Name>
   <DeploymentSlot>Production</DeploymentSlot>
   <Label>samplewinVM</Label>
   <RoleList>
      <Role>
         <RoleName>samplewinVM</RoleName>
         <RoleType>PersistentVMRole</RoleType>
         <ConfigurationSets>
            <ConfigurationSet>
               <ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>
               <ComputerName>samplewinVM</ComputerName>
               <AdminPassword>***********</AdminPassword>
               <ResetPasswordOnFirstLogon>false</ResetPasswordOnFirstLogon>
               <AdminUsername>dummyuser</AdminUsername>
            </ConfigurationSet>
            <ConfigurationSet>
               <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
               <InputEndpoints>
                  <InputEndpoint>
                     <LocalPort>3389</LocalPort>
                     <Name>rdp</Name>
                     <Port>3389</Port>
                     <Protocol>tcp</Protocol>
                  </InputEndpoint>
               </InputEndpoints>
               <SubnetNames />
               <PublicIPs />
               <NetworkInterfaces />
            </ConfigurationSet>
         </ConfigurationSets>
         <OSVirtualHardDisk>
            <MediaLink>https://foobar.blob.core.windows.net/vhd-store/foobar.vhd</MediaLink>
            <SourceImageName>a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20151120-en.us-127GB.vhd</SourceImageName>
         </OSVirtualHardDisk>
         <RoleSize>Standard_DS1</RoleSize>
         <ProvisionGuestAgent>true</ProvisionGuestAgent>
         <DebugSettings>
            <BootDiagnosticsEnabled>true</BootDiagnosticsEnabled>
         </DebugSettings>
      </Role>
   </RoleList>
   <VirtualNetworkName>testnet1</VirtualNetworkName>
   <ReservedIPName>MyReservedIP5</ReservedIPName>
</Deployment>

This issue would have been solved by the Compute team (in much less time) as it knows more about its API. Hope this helps.

amarzavery avatar Jul 16 '16 02:07 amarzavery