title: Upload .vhd as Page-Blob to azure-blob-storage from Url
body: <p>i have a bunch of VHD files stored on a private Server, which are accessible through a url.</p>
  <p>I am trying upload these vhd files directly to my azure storage account using the azure javascript npm libraries. The vhds have to be uploaded as page-blobs. I tried using the method uploadPagesFromURL() of the pageblobClient but with no success. My code looks roughly like this:</p>
  <pre><code> async function uploadVHD(accessToken, srcUrl) 
   {
       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(&quot;vhd-images&quot;);
           await containerClient.createIfNotExists();
      
           const src = srcUrl.replace('https://', 'https://username:password@');
             
           // Upload to blob storage
           const pageBlobClient = containerClient.getPageBlobClient(&quot;Test.vhd&quot;);
           // Get fileSize of vhd
           const fileSize = (await axiosRequest(src, { method: &quot;HEAD&quot; })).headers[&quot;content-length&quot;];
           const uploadResponse = await pageBlobClient.uploadPagesFromURL(src, 0, 0, fileSize);
      
           return uploadResponse;
       } catch (error) {
             
           return error;
       }
   });
  </code></pre>