{"action":"opened","issue":{"url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/2598","repository_url":"https://api.github.com/repos/Azure/azure-xplat-cli","labels_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/2598/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/2598/comments","events_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/2598/events","html_url":"https://github.com/Azure/azure-xplat-cli/issues/2598","id":138154867,"number":2598,"title":"Cannot add VM to availability set with --availset-name","user":{"login":"jotunskij","id":1684523,"avatar_url":"https://avatars.githubusercontent.com/u/1684523?v=3","gravatar_id":"","url":"https://api.github.com/users/jotunskij","html_url":"https://github.com/jotunskij","followers_url":"https://api.github.com/users/jotunskij/followers","following_url":"https://api.github.com/users/jotunskij/following{/other_user}","gists_url":"https://api.github.com/users/jotunskij/gists{/gist_id}","starred_url":"https://api.github.com/users/jotunskij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotunskij/subscriptions","organizations_url":"https://api.github.com/users/jotunskij/orgs","repos_url":"https://api.github.com/users/jotunskij/repos","events_url":"https://api.github.com/users/jotunskij/events{/privacy}","received_events_url":"https://api.github.com/users/jotunskij/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-03T11:40:57Z","updated_at":"2016-03-03T11:40:57Z","closed_at":null,"body":"CLI Version: 0.9.15 (node: 4.2.6)\r\nOS Type: Mac\r\nInstallation via: npm\r\n\r\nMode: ARM\r\n\r\nDescription:\r\nCreating VM does not assign it to given availability set (--availset-name flag). Adding another VM to the same load balancer gives an error regarding different availability sets for one load balancer. Viewing the VM and availset in the portal shows that no VMs are connected to the availset.\r\n\r\nSteps to reproduce:\r\n```\r\nazure config mode arm\r\nazure group create --name ksc01-resgrp --tags \"departement=ITA\" --location westeurope\r\nazure availset create --name ksc01-as-discovery --resource-group ksc01-resgrp --location westeurope\r\nazure availset create --name ksc01-as-masters --resource-group ksc01-resgrp --location westeurope\r\nazure network nsg create --resource-group ksc01-resgrp --name ksc01-nsg --location westeurope\r\nazure network vnet create --resource-group ksc01-resgrp --name ksc01-vnet --address-prefixes 10.0.0.0/16  --location westeurope\r\nazure network vnet subnet create --resource-group ksc01-resgrp --vnet-name ksc01-vnet --name ksc01-msub --address-prefix 10.0.1.0/24 --network-security-group-name ksc01-nsg\r\nazure network vnet subnet create --resource-group ksc01-resgrp --vnet-name ksc01-vnet --name ksc01-nsub --address-prefix 10.0.2.0/24 --network-security-group-name ksc01-nsg\r\nazure network public-ip create --resource-group ksc01-resgrp --name ksc01-dpubip --domain-name-label ksc01-disc --location westeurope\r\nazure network lb create --resource-group ksc01-resgrp --name ksc01-dlb --tags \"departement=ITA\" --location westeurope\r\nazure network lb frontend-ip create --resource-group ksc01-resgrp --name ksc01-dfrontip --public-ip-name ksc01-dpubip --lb-name ksc01-dlb\r\nazure network lb address-pool create --resource-group ksc01-resgrp --name ksc01-daddpool --lb-name ksc01-dlb\r\nazure network lb inbound-nat-rule create --resource-group ksc01-resgrp --name ksc01-disc01-2222-22 --lb-name ksc01-dlb --frontend-port 2222 --backend-port 22\r\nazure network nsg rule create --resource-group ksc01-resgrp --nsg-name ksc01-nsg --name ksc01-disc01-2222-22 --protocol Tcp --access Allow --source-address-prefix Internet --destination-address-prefix 10.0.1.5/32 --destination-port-range 22 --source-port-range 0-65535 --direction Inbound --priority 500\r\nazure network nic create --resource-group ksc01-resgrp --name ksc01-d01-nic --subnet-vnet-name ksc01-vnet --subnet-name ksc01-msub --private-ip-address 10.0.1.5 --lb-address-pool-ids /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Network/loadbalancers/ksc01-dlb/backendAddressPools/ksc01-daddpool --lb-inbound-nat-rule-ids /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Network/loadbalancers/ksc01-dlb/inboundNatRules/ksc01-disc01-2222-22 --location westeurope\r\nazure storage account create --resource-group ksc01-resgrp --type LRS kthd01storage --location westeurope\r\nazure vm create --vm-size Standard_A0 --ssh-publickey-file /Users/tinglev/.ssh/id_rsa.pub --resource-group ksc01-resgrp --os-type Linux --image-urn canonical:UbuntuServer:14.04.4-LTS:14.04.201602220 --nic-name ksc01-d01-nic --vnet-name ksc01-vnet --vnet-subnet-name ksc01-msub --admin-username **** --admin-password **** --name ksc01-disc01 --storage-account-name kthd01storage --tags \"departement=ITA\" --availset-name ksc01-as-discovery --location westeurope\r\nazure vm extension set ksc01-resgrp ksc01-disc01 VMAccessForLinux Microsoft.OSTCExtensions 1.4 --private-config-path ssh-conf.json\r\nazure network lb inbound-nat-rule create --resource-group ksc01-resgrp --name ksc01-disc02-2223-22 --lb-name ksc01-dlb --frontend-port 2223 --backend-port 22\r\nazure network nsg rule create --resource-group ksc01-resgrp --nsg-name ksc01-nsg --name ksc01-disc02-2223-22 --protocol Tcp --access Allow --source-address-prefix Internet --destination-address-prefix 10.0.1.6/32 --destination-port-range 22 --source-port-range 0-65535 --direction Inbound --priority 501\r\nazure network nic create --resource-group ksc01-resgrp --name ksc01-d02-nic --subnet-vnet-name ksc01-vnet --subnet-name ksc01-msub --private-ip-address 10.0.1.6 --lb-address-pool-ids /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Network/loadbalancers/ksc01-dlb/backendAddressPools/ksc01-daddpool --lb-inbound-nat-rule-ids /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Network/loadbalancers/ksc01-dlb/inboundNatRules/ksc01-disc02-2223-22 --location westeurope\r\nazure storage account create --resource-group ksc01-resgrp --type LRS kthd02storage --location westeurope\r\nazure vm create --vm-size Standard_A0 --ssh-publickey-file /Users/tinglev/.ssh/id_rsa.pub --resource-group ksc01-resgrp --os-type Linux --image-urn canonical:UbuntuServer:14.04.4-LTS:14.04.201602220 --nic-name ksc01-d02-nic --vnet-name ksc01-vnet --vnet-subnet-name ksc01-msub --admin-username **** --admin-password **** --name ksc01-disc02 --storage-account-name kthd02storage --tags \"owner=tinglev;departement=ITA\" --availset-name ksc01-as-discovery --location westeurope\r\n```\r\n\r\nError stack trace:\r\n\r\n```\r\n2016-03-03T11:29:44.314Z:\r\n{ [Error: Virtual Machine /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Compute/virtualMachines/ksc01-disc02 is using different Availability Set than other Virtual Machines connected to the Load Balancer(s) ksc01-dlb.]\r\n  stack: [Getter/Setter],\r\n  statusCode: 400,\r\n  request: \r\n   { rawResponse: false,\r\n     queryString: {},\r\n     method: 'PUT',\r\n     headers: \r\n      { 'x-ms-client-request-id': 'ddd7d8d9-77ea-4da4-84b5-7a9d62fd15af',\r\n        'accept-language': 'en-US',\r\n        'Content-Type': 'application/json; charset=utf-8',\r\n        'Content-Length': 962,\r\n        'user-agent': 'WindowsAzureXplatCLI/0.9.15' },\r\n     url: 'https://management.azure.com/subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Compute/virtualMachines/ksc01-disc02?api-version=2015-06-15',\r\n     body: '{\"properties\":{\"hardwareProfile\":{\"vmSize\":\"Standard_A0\"},\"storageProfile\":{\"imageReference\":{\"publisher\":\"canonical\",\"offer\":\"UbuntuServer\",\"sku\":\"14.04.4-LTS\",\"version\":\"14.04.201602220\"},\"osDisk\":{\"name\":\"clie3a22e9737aca902-os-1457004583123\",\"vhd\":{\"uri\":\"https://kthd02storage.blob.core.windows.net/vhds/clie3a22e9737aca902-os-1457004583123.vhd\"},\"caching\":\"ReadWrite\",\"createOption\":\"FromImage\"}},\"osProfile\":{\"computerName\":\"ksc01-disc02\",\"adminUsername\":\"****\",\"adminPassword\":\"****\",\"linuxConfiguration\":{\"disablePasswordAuthentication\":false}},\"networkProfile\":{\"networkInterfaces\":[{\"id\":\"/subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Network/networkInterfaces/ksc01-d02-nic\"}]},\"diagnosticsProfile\":{\"bootDiagnostics\":{\"enabled\":true,\"storageUri\":\"https://kthd02storage.blob.core.windows.net/\"}}},\"name\":\"ksc01-disc02\",\"location\":\"westeurope\",\"tags\":{\"departement\":\"ITA\"}}' },\r\n  response: \r\n   { body: '{\\r\\n  \"error\": {\\r\\n    \"details\": [],\\r\\n    \"code\": \"VmIsNotInSameAvailabilitySetAsLb\",\\r\\n    \"message\": \"Virtual Machine /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Compute/virtualMachines/ksc01-disc02 is using different Availability Set than other Virtual Machines connected to the Load Balancer(s) ksc01-dlb.\"\\r\\n  }\\r\\n}',\r\n     headers: \r\n      { 'cache-control': 'no-cache',\r\n        pragma: 'no-cache',\r\n        'content-length': '372',\r\n        'content-type': 'application/json; charset=utf-8',\r\n        expires: '-1',\r\n        'strict-transport-security': 'max-age=31536000; includeSubDomains',\r\n        'x-ms-served-by': '248f93ee-5362-43f4-b0fe-0e20ddbf2ab4_131014272123332011',\r\n        'x-ms-request-id': 'c88fe798-bec7-40e3-925c-cac98f83be0f',\r\n        server: 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0',\r\n        'x-ms-ratelimit-remaining-subscription-writes': '1199',\r\n        'x-ms-correlation-request-id': 'e049c906-6106-44cd-8c6d-cb9759e1f8d7',\r\n        'x-ms-routing-request-id': 'WESTEUROPE:20160303T112944Z:e049c906-6106-44cd-8c6d-cb9759e1f8d7',\r\n        date: 'Thu, 03 Mar 2016 11:29:43 GMT',\r\n        connection: 'close' },\r\n     statusCode: 400 },\r\n  code: 'VmIsNotInSameAvailabilitySetAsLb',\r\n  body: \r\n   { code: 'VmIsNotInSameAvailabilitySetAsLb',\r\n     message: 'Virtual Machine /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Compute/virtualMachines/ksc01-disc02 is using different Availability Set than other Virtual Machines connected to the Load Balancer(s) ksc01-dlb.',\r\n     details: [] },\r\n  __frame: \r\n   { name: 'createOrUpdateVM__14',\r\n     line: 180,\r\n     file: '/usr/local/lib/node_modules/azure-cli/lib/commands/arm/vm/virtualMachine._js',\r\n     prev: \r\n      { name: 'createVM__1',\r\n        line: 55,\r\n        file: '/usr/local/lib/node_modules/azure-cli/lib/commands/arm/vm/vmClient._js',\r\n        prev: [Object],\r\n        calls: 3,\r\n        active: false,\r\n        offset: 108,\r\n        col: 19 },\r\n     calls: 0,\r\n     active: false,\r\n     offset: 18,\r\n     col: 81 },\r\n  rawStack: [Getter] }\r\nError: Virtual Machine /subscriptions/****/resourceGroups/ksc01-resgrp/providers/Microsoft.Compute/virtualMachines/ksc01-disc02 is using different Availability Set than other Virtual Machines connected to the Load Balancer(s) ksc01-dlb.\r\n  <<< async stack >>>\r\n  at createOrUpdateVM__14 (/usr/local/lib/node_modules/azure-cli/lib/commands/arm/vm/virtualMachine._js:198:82)\r\n  at createVM__1 (/usr/local/lib/node_modules/azure-cli/lib/commands/arm/vm/vmClient._js:163:20)\r\n  at __1 (/usr/local/lib/node_modules/azure-cli/lib/commands/arm/vm/vm._js:132:16)\r\n  <<< raw stack >>>\r\n    at /usr/local/lib/node_modules/azure-cli/node_modules/azure-arm-compute/lib/operations/virtualMachines.js:905:19\r\n    at retryCallback (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/filters/exponentialRetryPolicyFilter.js:140:9)\r\n    at handleRedirect (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/filters/redirectFilter.js:36:9)\r\n    at /usr/local/lib/node_modules/azure-cli/lib/util/utils.js:482:7\r\n    at handleRedirect (/usr/local/lib/node_modules/azure-cli/lib/util/utils.js:459:9)\r\n    at /usr/local/lib/node_modules/azure-cli/lib/util/logging.js:401:7\r\n    at Request._callback (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/requestPipeline.js:125:16)\r\n    at Request.self.callback (/usr/local/lib/node_modules/azure-cli/node_modules/request/request.js:344:22)\r\n    at emitTwo (events.js:87:13)\r\n    at Request.emit (events.js:172:7)\r\n```\r\n"}}