using Azure.Storage; using Azure.Storage.Blobs; Console.WriteLine("Template Migration"); var source_myAccountKey = ""; var source_myAccountName = ""; var destination_myAccountKey = ""; var destination_myAccountName = ""; //Source string source_blob_uri = "https://" + source_myAccountName + ".blob.core.windows.net"; StorageSharedKeyCredential source_creds = new StorageSharedKeyCredential(source_myAccountName, source_myAccountKey); BlobServiceClient source_blobClient = new BlobServiceClient(new Uri(source_blob_uri), source_creds); //Destination string destination_blob_uri = "https://" + destination_myAccountName + ".blob.core.windows.net"; StorageSharedKeyCredential destination_creds = new StorageSharedKeyCredential(destination_myAccountName, destination_myAccountKey); BlobServiceClient destination_blobClient = new BlobServiceClient(new Uri(destination_blob_uri), destination_creds); BlobContainerClient source_blobContainerClient = source_blobClient.GetBlobContainerClient("templates"); var segment = source_blobContainerClient.GetBlobs(); foreach (var page in segment) //This looks at all the files inside each specific container folder { BlobClient source_blobClients = source_blobContainerClient.GetBlobClient(page.Name); var ret = new MemoryStream(); using (var stream = new MemoryStream()) { source_blobClients.DownloadTo(stream); stream.Position = 0; destination_blobClient.GetBlobContainerClient("location").UploadBlob(page.Name, stream, default); } Console.WriteLine(page.Name); }