In this article, I am going to show, how you can copy
Blob from one container to another container in Azure Function Portal.
Below are the steps:
I have one: Storage Account =
saqar
Two Container inside this Storage Account
- source
- destination

Image 1.
I will create a Function App = testFunctionAppQAR
Inside this I will add a Blob Trigger function.
So that
if any blob comes inside source container then it should copy current uploaded
blob to destination container.
Step 1: Create a New Function App:

Image 2.
Click on Create.

Image 3.

Image 4.

Image 5.
Now add a new file project.json to download NuGet
package.

Image 6.
Add below code in your project.json file:
{
"frameworks": {
"net46":{
"dependencies": {
"WindowsAzure.Storage": "7.0.0"
}
}
}
}

Image 7.
Save it and check Log.
Now click on Integrate from left side:

Image 8.
Now Open run.csx file and do below code:
using System;
using System.IO;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
{
log.Info("COPY
BLOB- AZURE FUNCTION START....");
await
CopyBlob(myBlob, log);
}
private async static Task CopyBlob(CloudBlockBlob myBlob, TraceWriter log)
{
var
storageAccountkey = "ncYwHsiu9tFxGhDBksgSbjIeEh4JvbJGNxU3yTztGOz9S8go8Gj7wSMVdLZnfcQkWuCo+lDEA9B2eoESHZrHig==";
var
connectionString = $"DefaultEndpointsProtocol=https;AccountName=saqar;AccountKey={storageAccountkey}";
CloudStorageAccount
storageAccount = CloudStorageAccount.Parse(connectionString);
//
destination blob client
CloudBlobClient
blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer
container = blobClient.GetContainerReference("destination");
// Check
if destination container Exist or Not
try
{
await
container.CreateIfNotExistsAsync();
}
catch(Exception
e)
{
log.Error(e.Message);
}
// Get
Reference of Blob
CloudBlockBlob blockBlob
= container.GetBlockBlobReference(myBlob.Name);
log.Info($"BlockBlob
- destination name: {blockBlob.Name}");
log.Info("Blob
Starting Copy...");
try
{
//copy to
blob
blockBlob.BeginStartCopy(myBlob, null, null);
log.Info("Blob
Copied Succeeded.");
}
catch(Exception
ex)
{
log.Error(ex.Message);
log.Info("Error
in Copying.");
}
finally
{
log.Info("========Copy
Operation completed========");
}
}

Image 9.
Now upload a file in source container and check
destination container, whether it copied blob or not.

Image 10.

Image 11.