title: Unable to copy blob from one storage account to another
body: <p>I'm trying to copy a blob from one Azure storage account to another storage account (same subscription) but I get an exception:</p>
  
  <blockquote>
    <p>The specified resource does not exist.</p>
  </blockquote>
  
  <p>As I've realised, the problem is caused by the container being set to <code>Private</code>, which is what it should be for our business purposes.</p>
  
  <p>I've taken my cue from <a href="https://stackoverflow.com/a/40054739/262892">this SO answer</a> which suggests:</p>
  
  <blockquote>
    <p>Create a Shared Access Signature (SAS) on the source blob with at least Read permission and an expiry date of at least 15 days and use that SAS URL (blob URL + SAS token) as copy source.</p>
  </blockquote>
  
  <p>Furthermore, I've found some code on the <a href="https://social.msdn.microsoft.com/Forums/en-US/0b5e7814-d0df-41fa-b6dc-2439c730986b/how-to-use-copy-blob-usng-sas?forum=windowsazuredata" rel="nofollow noreferrer">Microsoft forums</a> from the same poster where he posts code that worked for him. From that, I now have the following code (<code>ct</code> is a <code>CancellationToken</code>):</p>
  
  <pre><code>var snapshot = await blob.CreateSnapshotAsync(ct);
  var sourceSAS = snapshot.GetSharedAccessSignature(new SharedAccessBlobPolicy {
                                                                                  Permissions = SharedAccessBlobPermissions.Read,
                                                                                  SharedAccessExpiryTime = DateTime.Now.AddYears(1),
                                                                                  SharedAccessStartTime = DateTimeOffset.Now.AddHours(-1)
                                                                              });
  var sourceUri = $"{snapshot.Uri}{sourceSAS}";
  
  var backupBlob = FileBackupContainer.GetBlockBlobReference(blob.Name);
  var targetSAS = backupBlob.GetSharedAccessSignature(new SharedAccessBlobPolicy {
                                                                                    Permissions = SharedAccessBlobPermissions.Write,
                                                                                    SharedAccessExpiryTime = DateTime.Now.AddYears(1),
                                                                                    SharedAccessStartTime = DateTimeOffset.Now.AddHours(-1)
                                                                                });
  var targetUri = $"{backupBlob.Uri}{targetSAS}";
  
  var newTargetBlob = new CloudBlockBlob(new Uri(targetUri));
  await newTargetBlob.StartCopyAsync(new Uri(sourceUri), ct);
  
  await snapshot.DeleteAsync(ct);
  </code></pre>
  
  <p>But I still encounter the same exception.</p>
  
  <p>What more do I need in order to copy a blob using its SAS?</p>
  
  <p><strong>UPDATE:</strong><br>
  My code wasn't working because the source blob was in my local storage emulator (<em>i.e.</em> localhost) which is obviously inaccessible to the target storage container which is Azure-hosted.</p>