{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-storage-python/issues/112","repository_url":"https://api.github.com/repos/Azure/azure-storage-python","labels_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/112/comments","events_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/112/events","html_url":"https://github.com/Azure/azure-storage-python/issues/112","id":131934422,"number":112,"title":"Cannot delete snapshots - Authentication Error","user":{"login":"ahirner","id":6055037,"avatar_url":"https://avatars.githubusercontent.com/u/6055037?v=3","gravatar_id":"","url":"https://api.github.com/users/ahirner","html_url":"https://github.com/ahirner","followers_url":"https://api.github.com/users/ahirner/followers","following_url":"https://api.github.com/users/ahirner/following{/other_user}","gists_url":"https://api.github.com/users/ahirner/gists{/gist_id}","starred_url":"https://api.github.com/users/ahirner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahirner/subscriptions","organizations_url":"https://api.github.com/users/ahirner/orgs","repos_url":"https://api.github.com/users/ahirner/repos","events_url":"https://api.github.com/users/ahirner/events{/privacy}","received_events_url":"https://api.github.com/users/ahirner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-07T04:32:48Z","updated_at":"2016-02-24T18:02:35Z","closed_at":"2016-02-24T18:02:35Z","body":"I'm running a VM with infinitely leased storage from OS blobs. The following works:\r\n```\r\nfrom azure.storage.blob import BlobService\r\nblob_service = BlobService(AZURE_STORAGE_ACCOUNT, AZURE_STORAGE_ACCESS_KEY)\r\nblobs = [b for b in blob_service.list_blobs(CONTAINER, include='snapshots')]\r\nfor b in blobs: print b.name + \"|\" + b.snapshot\r\n```\r\nThere is a minor anomaly though, any blobs[i].snapshot returns an empty string u'' (Python 2.7). I'm certain that but one blob was created from the Azure portal by capturing it.\r\n\r\nNow, deleting such a captured blob fails:\r\n```\r\nblob_service.delete_blob('vhds', blobs[1].name, snapshot=blobs[1].snapshot)\r\nAzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\r\n\r\n<Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\r\nRequestId:\r\nTime:2016-02-07T04:19:22.2515532Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request &apos;Thp/816hcXlHBbAt0Xne6iCJK5y87kD1nmCCOQZH7hY=&apos; is not the same as any computed signature. Server used following string to sign: &apos;DELETE\r\nx-ms-date:Sun, 07 Feb 2016 04:19:22 GMT\r\nx-ms-version:2014-02-14\r\nsnapshot:&apos;.</AuthenticationErrorDetail></Error>\r\n```\r\nThe same authentication error is thrown when I try the indirect way via shared access policy and the respective token, but even earlier (listing the blobs):\r\n```\r\nblob_service = BlobService(AZURE_STORAGE_ACCOUNT, AZURE_STORAGE_ACCESS_KEY)\r\nap = AccessPolicy(\r\n    expiry='2016-10-12',\r\n    permission=BlobSharedAccessPermissions.WRITE,\r\n)\r\nsas_token = blob_service.generate_shared_access_signature(\r\n    container_name='vhds',\r\n    blob_name=blobs[1].name,\r\n    shared_access_policy=SharedAccessPolicy(ap),\r\n)\r\nblob_service = BlobService(AZURE_STORAGE_ACCOUNT, sas_token=sas_token)\r\nblobs = [b for b in blob_service.list_blobs('vhds', include='snapshots')]\r\n^-- same exception as above\r\n```\r\n\r\nIt's crucial to delete old snapshots and I haven't yet a way around this problem. Any ideas where the requests are misformed or the root cause of the failure is?"},"comment":{"url":"https://api.github.com/repos/Azure/azure-storage-python/issues/comments/188384460","html_url":"https://github.com/Azure/azure-storage-python/issues/112#issuecomment-188384460","issue_url":"https://api.github.com/repos/Azure/azure-storage-python/issues/112","id":188384460,"user":{"login":"emgerner-msft","id":5225146,"avatar_url":"https://avatars.githubusercontent.com/u/5225146?v=3","gravatar_id":"","url":"https://api.github.com/users/emgerner-msft","html_url":"https://github.com/emgerner-msft","followers_url":"https://api.github.com/users/emgerner-msft/followers","following_url":"https://api.github.com/users/emgerner-msft/following{/other_user}","gists_url":"https://api.github.com/users/emgerner-msft/gists{/gist_id}","starred_url":"https://api.github.com/users/emgerner-msft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emgerner-msft/subscriptions","organizations_url":"https://api.github.com/users/emgerner-msft/orgs","repos_url":"https://api.github.com/users/emgerner-msft/repos","events_url":"https://api.github.com/users/emgerner-msft/events{/privacy}","received_events_url":"https://api.github.com/users/emgerner-msft/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T18:02:35Z","updated_at":"2016-02-24T18:02:35Z","body":"Okay, sounds like you figured it out then. I'll close the issue. \r\n\r\nFYI: If they're storage leases and you absolutely need to break them manually you can use the break_blob_lease method (in 0.30.0) or in older versions, lease_blob with the lease action set to break. That being said, your method is probably safer and more recommended, especially on active machines."}}