The Azure Code Samples are currently available in English

Sample: copy data one folder to another folder in an Azure Blob Storage

最終更新: 2017/09/13
GitHub で編集

In this sample you do the following steps by using .NET SDK:

  1. Create a data factory.
  2. Create a linked service to link your Azure Storage account to the data factory.
  3. Create a dataset that represents input/output data used by the copy activity.
  4. Create a pipeline with a copy activity that copies data.


  • Azure subscription. If you don't have a subscription, you can create a free trial account.
  • Azure Storage account. You use the blob storage as source and sink data store. If you don't have an Azure storage account, see the Create a storage account article for steps to create one.
  • Create a blob container in Blob Storage, create an input folder in the container, and upload some files to the folder.
  • Visual Studio 2015 Update 3, or 2017. The walkthrough in this article uses Visual Studio 2017.
  • Download and install Azure .NET SDK.
  • Create an application in Azure Active Directory following this instruction. Make note of the following values that you use in later steps: application ID, authentication key, and tenant ID. Assign application to "Contributor" role by following instructions in the same article.

Build and run the sample

  1. Click Tools -> NuGet Package Manager -> Package Manager Console.
  2. In the Package Manager Console, run the following commands to install packages:

    Install-Package Microsoft.Azure.Management.DataFactory
    Install-Package Microsoft.Azure.Management.ResourceManager
    Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory
  3. Set values for variables in the Program.cs file:

    string tenantID = "<tenant ID>";
    string applicationId = "<application ID>";
    string authenticationKey = "<application key>";
    string subscriptionId = "<subscription ID>";
    string resourceGroup = "<resource group name>";
    string region = "East US";
    string dataFactoryName = "<data factory name>";
    string storageAccount = "<azure storage account name>";
    string storageKey = "<azure storage account key>";
    string inputBlobPath = "<blobcontainer/inputfolder>";
    string outputBlobPath = "<blobcontainer/outputfolder>"; 
  4. Add some text files to the input folder in the Azure Blob Storage.

  5. Build the project and run the program.

  6. Verify that the files are copied to the destination location in the Blob Storage.

See Also

For step-by-steps instructions to create this sample from scratch, see Quickstart: create a data factory and pipeline using .NET SDK.