@deherman-MSFT
Hey, I looked through the samples you sent which were somewhat helpful, sadly the method syncCopyPagesFromURL() isn't explained in these. And when trying to use this method i get one of 2 errors. I guess i am using the method wrong but i can't find alot of info about how to use it. When trying to upload a file from a public Url i get the following:
RestError: The value for one of the HTTP headers is not in the correct format.
When trying to upload a file from a private Url i get the following:
RestError: Could not verify the copy source within the specified time.
I didn't find a way to set the headers for authentication for my download source so i tried authenticating with username:password@/.../...
Also i am able to upload from public url using the blockBlobClient, so i don't think there is a problim with the Shared Access Signature.
The code in question roughly looks something like this:
function uploadVHD(accessToken, )
{
try {
// Get credentials from accessToken
const creds = new StorageSharedKeyCredential(storageAccount.name, storageAccount.key);
// Get blobServiceClient
const blobServiceClient = new BlobServiceClient(`https://${storageAccount.name}.blob.core.windows.net`, creds);
// Create Container
const containerClient = blobServiceClient.getContainerClient("vhd-images");
await containerClient.createIfNotExists();
const src = req.body.payload.image.srcUrl.replace('https://', 'https://username:password@');
// Upload to blob storage
const pageBlobClient = containerClient.getPageBlobClient("Test.vhd");
const fileSize = (await axiosRequest(src, { method: "HEAD" })).headers["content-length"];
const uploadResponse = await pageBlobClient.uploadPagesFromURL(src, 0, 0, fileSize);
return uploadResponse;
} catch (error) {
return error;
}
});