New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy VM page blob from one Azure subscription to another subscription #59
Comments
To copy a blob across accounts, you need to use a SAS token for the source or mark the source container for public access. See the "Authorization" section of the following page: So for example your code could generate a SAS token granting read access to the source blob, append it to the source blob URL's query string, and then start the copy from the URL. |
mirobers response is spot on. If you're looking for the specific APIs, check out generateSharedAccessSignature on the blob object. You can use the token returned by this to either make a new CloudStorageAccount and follow the code flow above to get a blob reference from that, or append it to the blob URL and use the CloudBlockBlob(URL) constructor to directly get a blob reference. Your code has one additional problem in that getCopyState does not make a service call. This is just getting the blob copy state previously set by startCopy. Inside your while loop you should try using downloadAttributes instead which will actually do a service call to get the updated copy information from the blob. |
Thanks, using the following code works:
However this approach doesn't seem to like being used from behind a proxy (that doesn't require authentication). When going via a proxy (using -Dhttps.proxyHost & -Dhttps.proxyPort) I get the following response on line
I tried setting the proxy option on OperationContext instead but the code hung on the first service call (eventually it returns a |
Proxy on OperationContext and proxy via JVM should work, and we've tested it works with a particular proxy. If you're getting auth failures I'd expect that your proxy is adding or removing headers which affects our authentication (hence 'Server failed to authenticate'). Check if this is the case with your proxy and which particular headers it's adding/removing and we can maybe try to help you find a work around. |
Thanks Emily, I suspected the proxy would get in the way somehow. Don't suppose you have any suggestion on how I could inspect my request after it's passed through the proxy in question? Unfortunately I've got zero control over the proxy. |
There's a variety of tooling available for this on the internet. Wireshark is probably the most generic across platforms and has the most flexibility. I'm not sure exactly how it interacts with proxies but given how low-level it is I'd say it's a good shot. |
Thanks for the suggestion Emily, unfortunately I cannot intercept my request using Wireshark once it's passed through the proxy. If I get any joy finding out what's happening with the proxy I'll let you know. |
I'm trying to use the Azure Storage SDK for Java to copy the page blob of an Azure VM (that is Stopped and Deallocated) from one Azure subscription to another.
Here's the code I'm using:
No matter what I try I always get the following error returned to me:
I've tried using v1.3.1, v3.1.0 & v4.0.0 of the SDK library and get the same error using both blob.startCopyFromBlob() (v1.3.1 & v3.1.0) and blob.startCopy() (v4.0.0).
The page blob in question has no lease, as the Azure Management Portal says the lease status is "Unlocked" and it does exist, even the Azure API confirms this by entering the code block at line 42.
I've tried copying the blob to another storage account within the same subscription and that gives the same error too.
Looking at the exception in more detail the error code is "CannotVerifyCopySource".
What am I doing wrong?
The text was updated successfully, but these errors were encountered: