{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/1535","labels_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/1535/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/1535/comments","events_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/1535/events","html_url":"https://github.com/Azure/azure-xplat-cli/issues/1535","id":54512115,"number":1535,"title":"'azure vm show' results in many 404 requests and causes API limits to be exceeded","user":{"login":"dazwin","id":4027649,"avatar_url":"https://avatars.githubusercontent.com/u/4027649?v=3","gravatar_id":"","url":"https://api.github.com/users/dazwin","html_url":"https://github.com/dazwin","followers_url":"https://api.github.com/users/dazwin/followers","following_url":"https://api.github.com/users/dazwin/following{/other_user}","gists_url":"https://api.github.com/users/dazwin/gists{/gist_id}","starred_url":"https://api.github.com/users/dazwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazwin/subscriptions","organizations_url":"https://api.github.com/users/dazwin/orgs","repos_url":"https://api.github.com/users/dazwin/repos","events_url":"https://api.github.com/users/dazwin/events{/privacy}","received_events_url":"https://api.github.com/users/dazwin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-xplat-cli/labels/IAAS","name":"IAAS","color":"02d7e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-15T22:13:23Z","updated_at":"2015-02-11T00:57:51Z","closed_at":"2015-02-11T00:57:51Z","body":"Related to Azure support issue 115011212256645. Executing 'azure vm show' several times in a loop (as would happen if you are waiting for a VM to come up) results in an excessive amount of invalid calls (404s) to Azure web services.\r\n\r\nThis doesn't cause 'azure vm show' to fail, but does cause a subsequent 'azure vm disk create' to fail.\r\n\r\nHere's a trace of one of those calls per the support ticket (note the 'sqlserver' value and the 404 response code):\r\n\r\n```\r\n=== <SubscriptionOperation> ===\r\n  OperationId:306562b5-4de0-58c4-b989-bbbef841c155\r\n  OperationName:RegisterResource\r\n  OperationObjectId:/e11b9fe3-f90c-48b4-b0fe-b872e7635f84/services\r\n  UserEmailAddress:Unknown\r\n  ClientIP:###.###.###.###\r\n  SubscriptionCertificateThumbprint:########################################\r\n  UsedServiceManagementApi:True\r\n  === <OperationParameters> ===\r\n    Name:subscriptionID\r\n    Value:########-####-####-####-############\r\n    Name:resourceName\r\n    Value:sqlserver\r\n    Name:action\r\n    Value:register\r\n  === </OperationParameters> ===\r\n === <OperationTrackingData> ===\r\n    OperationId:306562b5-4de0-58c4-b989-bbbef841c155\r\n    OperationKind:RegisterResourceOperation\r\n    OperationStatus:Failed\r\n    SubscriptionId:########-####-####-####-############\r\n    TimeStarted:1/9/2015 12:57:04 AM\r\n    TimeCompleted:1/9/2015 12:57:04 AM\r\n    HttpStatusCode:404\r\n    === <ErrorDetail> ===\r\n      Timestamp:1/9/2015 12:57:04 AM\r\n      HostName:RD00155D411ECC\r\n      ExtendedDescription:The service name is unknown.\r\n      Code:ExtensionServicesError\r\n      ErrorDetail.Address:####::####:####:####:####%12\r\n      ErrorDetail.Address:####::####:####:####:####%14\r\n      ErrorDetail.Address:###.###.###.###\r\n      ErrorDetail.Address:2001:0:####:####:####:####:####:####\r\n    === </ErrorDetail> ===\r\n  === </OperationTrackingData> ===\r\n=== </SubscriptionOperation> ===\r\n```\r\n\r\n**Repro steps**\r\nThe following script reproduces this problem:\r\n\r\n```\r\n#!/bin/bash -x\r\n\r\nvm_name=mymachine\r\nazure_storage_account= mystorage\r\nssh_certificate_file=mykey.pem\r\nssh_user=myuser\r\nazure_storage_devops_snapshot=\"mysourcevhd\"\r\nazure_storage_devops_disk=$vm_name\r\nazure_storage_account_key=`azure storage account keys list $azure_storage_account --json | python -c 'import sys; import json; print json.load(sys.stdin)[\"primaryKey\"];'`\r\n\r\nazure vm create -l 'West US' -z Large --ssh 22 --ssh-cert $ssh_certificate_file --no-ssh-password $vm_name b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GB $ssh_user\r\nfor i in {1..4}; do\r\n  azure vm show $vm_name # Usually, there will be a sleep here\r\ndone\r\nazure vm disk upload \"https://$azure_storage_account.blob.core.windows.net/vhds/$azure_storage_devops_snapshot.vhd\" \"http://$azure_storage_account.blob.core.windows.net/vhds/$azure_storage_devops_disk.vhd\" \"$azure_storage_account_key\"\r\nazure vm disk create --os linux --blob-url http://$azure_storage_account.blob.core.windows.net/vhds/$azure_storage_devops_disk.vhd $azure_storage_devops_disk\r\n```\r\n\r\nThe API limits appear to be triggered by the 4th call (if the loop count is 3, the script will succeed).\r\n<!---@tfsbridge:{\"tfsId\":3273259}-->"},"comment":{"url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/comments/73817063","html_url":"https://github.com/Azure/azure-xplat-cli/issues/1535#issuecomment-73817063","issue_url":"https://api.github.com/repos/Azure/azure-xplat-cli/issues/1535","id":73817063,"user":{"login":"kmouss","id":7134811,"avatar_url":"https://avatars.githubusercontent.com/u/7134811?v=3","gravatar_id":"","url":"https://api.github.com/users/kmouss","html_url":"https://github.com/kmouss","followers_url":"https://api.github.com/users/kmouss/followers","following_url":"https://api.github.com/users/kmouss/following{/other_user}","gists_url":"https://api.github.com/users/kmouss/gists{/gist_id}","starred_url":"https://api.github.com/users/kmouss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmouss/subscriptions","organizations_url":"https://api.github.com/users/kmouss/orgs","repos_url":"https://api.github.com/users/kmouss/repos","events_url":"https://api.github.com/users/kmouss/events{/privacy}","received_events_url":"https://api.github.com/users/kmouss/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T00:57:51Z","updated_at":"2015-02-11T00:57:51Z","body":"Please feel free to re-open. Closing this per recommendation above."}}