Hello @Sturla ,
I don't see the complete piece of code , hence can't repro locally - but this is definitely seems be an issue with the SAS Key account token which was generated. Can you check the value of the variable sasUri ?
How did you generate the SAS Key ? Can you try to re-generate the SAS key of the target and try to test it out manually (i.e. local instead of Azure App Service).
In general the complete SAS URI format will be something like below: (Dummy key)
https://forsharing.blob.core.windows.net/test2/test2?sv=2020-04-08&se=2022-06-03T01%3A45%3A12Z&sr=b&sp=r&sig=tQEUiBBq8HBmdygLABDCEFG8ZwvypaAVD3liBcCDGmc%2FI%3D
I was testing out below sample piece of code to copy the data from one blob to another blob with-in the same storage account without downloading the blob , but it uses Storage Account Key instead of SAS.
Can you try out the sample source code mentioned at : https://learn.microsoft.com/en-us/learn/modules/copy-blobs-from-command-line-and-code/7-move-blobs-using-net-storage-client
Below is the modified piece of code from above document: (From one storage account blob to another storage account blob)
public static async void CopyFromOneBlobStorageAccountToAnotherBlobStorageAccount()
{
try
{
var sourceConnection = "DefaultEndpointsProtocol=https;AccountName=forsharing;AccountKey=key==;EndpointSuffix=core.windows.net";
BlobServiceClient sourceClient = new BlobServiceClient(sourceConnection);
BlobServiceClient destClient = new BlobServiceClient(sourceConnection);
string sourceContainer = "test2";
string destContainer = "test3";
BlobContainerClient sourceBlobContainer = sourceClient.GetBlobContainerClient(sourceContainer);
BlobContainerClient destBlobContainer = destClient.GetBlobContainerClient(destContainer);
BlobClient destBlob = destBlobContainer.GetBlobClient(sourceBlobContainer.Name);
CopyFromUriOperation ops = await destBlob.StartCopyFromUriAsync(GetSharedAccessUri(sourceBlobContainer.Name, sourceBlobContainer));
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
// Create a SAS token for the source blob, to enable it to be read by the StartCopyFromUriAsync method
private static Uri GetSharedAccessUri(string blobName, BlobContainerClient container)
{
DateTimeOffset expiredOn = DateTimeOffset.UtcNow.AddMinutes(60);
BlobClient blob = container.GetBlobClient(blobName);
Uri sasUri = blob.GenerateSasUri(BlobSasPermissions.Read, expiredOn);
return sasUri;
}
If you are still facing the issue , kindly post the whole code so that we can help you out accordingly