Certainly! Below is a detailed step-by-step guide to upload 3 files into Azure Blob Storage and then move those files into Azure Data Lake Storage Gen2 (ADLS Gen2) using Azure Data Factory (ADF).
Step 1: Upload 3 Files into Azure Blob Storage
Option 1 - Upload Files Manually (via Azure Portal):
- Sign in to the Azure Portal.
- Go to your Storage Account where you want to upload the files.
- Select Containers under Data storage.
- Click or create a container (e.g.,
input-files).
- Inside the container, click Upload, and select your 3 files from your local machine.
- Once uploaded, verify the files appear in the container.
Step 2: Create Azure Data Factory (if not already created)
- In the Azure Portal, click Create a resource.
- Search for Data Factory and click Create.
- Enter your resource details (resource group, region, Data Factory name).
- Click Review + create, then Create.
- Once deployed, go to the Data Factory and click Author & Monitor to launch ADF Studio.
Step 3: Define Linked Services in Azure Data Factory
Linked Services define the connection to your data stores (Blob Storage and ADLS Gen2).
3.1 Create Linked Service for Azure Blob Storage
- In ADF Studio, go to the Manage tab (gear icon on the left).
- Click Linked services > New.
- Select Azure Blob Storage, click Continue.
- Fill the form:
- Name:
AzureBlobStorageLinkedService
- Storage account name: Choose your Blob Storage.
- Authentication method: Use account key, managed identity, or service principal.
- Click Test connection (should succeed).
- Click Create.
3.2 Create Linked Service for Azure Data Lake Storage Gen2
- Again in Linked services, click New.
- Choose Azure Data Lake Storage Gen2.
- Fill the form:
- Name:
ADLSGen2LinkedService
- Storage account name: Choose your ADLS Gen2 account.
- Authentication method: e.g., account key or managed identity.
- Click Test connection.
- Click Create.
Step 4: Create Datasets for Source and Sink
Datasets represent the files/folders in your data stores.
4.1 Create Dataset for Azure Blob Storage (Source)
- Go to Author tab (pencil icon).
- Click + > Dataset.
- Choose Azure Blob Storage.
- Select the format type (e.g., Binary if files are arbitrary, or CSV if files are CSV).
- Click Continue.
- Name it e.g.,
BlobStorageFiles.
- For Linked service, choose
AzureBlobStorageLinkedService.
- Set the File path (container and folder) where you uploaded the files, e.g.:
- Container:
input-files
- Folder: (optional)
- Under File, leave empty or use
* as wildcard to copy all files.
- Click OK.
For more control, you can parameterize the dataset for dynamic filenames and path.
4.2 Create Dataset for Azure Data Lake Storage Gen2 (Sink)
- Repeat the process: Author > + > Dataset.
- Choose Azure Data Lake Storage Gen2.
- Choose the file format same as source.
- Name it e.g.,
ADLSGen2Files.
- Choose linked service
ADLSGen2LinkedService.
- Specify container and folder path where you want to store moved files, e.g.:
- Container:
datalake-files
- Folder:
moved-files
- Leave filename empty to enable writing multiple files or parameterize for specific files.
- Click OK.
Step 5: Create Pipeline to Move Files from Blob Storage to ADLS Gen2
5.1 Create New Pipeline
- Inside ADF Studio Author tab, click + > Pipeline.
- Name the pipeline e.g.,
MoveFilesBlobToADLS.
5.2 Add Copy Data Activity
- In Activities pane (left side), drag Copy Data activity into pipeline canvas.
- Click on the Copy Activity.
- Configure the Source tab:
- Choose source dataset:
BlobStorageFiles.
- To get all 3 files, use wildcard file path, for example:
*.txt or * to copy all.
- Optional: Enable Recursively if your files are in subfolders.
- Configure the Sink tab:
- Choose sink dataset:
ADLSGen2Files.
- Leave filename empty or specify folder path to store files with the same filenames.
- Under Settings tab:
- Enable Preserve hierarchy if you want to keep folder structure.
- Leave default for others.
- Validate the pipeline (little checkmark at the top).
5.3 (Optional) If You Want to Copy Specific 3 Files (Not all files)
To copy 3 specific files explicitly:
-
Create an array parameter for file names in pipeline properties:
- Open pipeline properties (click blank area on canvas)
- Add parameter, e.g.,
fileNames of type Array
- Set default value:
[ "file1.csv", "file2.csv", "file3.csv" ]
-
Use ForEach activity:
- Drag ForEach activity on pipeline
- Set its items to
@pipeline().parameters.fileNames
- Inside ForEach, add one Copy Data activity.
-
Configure nested Copy Data Activity:
- Source dataset (BlobStorageFiles) with parameterized filename:
- Create parameters in dataset for filename.
- Pass current item from ForEach (
@item()).
- Sink dataset similarly adjusted for filename.
This way, you copy these exact files one by one.
Step 6: (Optional) Delete Files from Blob Storage After Copying
If you want to move (not just copy) files, you need to delete them from Blob Storage after copy.
- Add a Delete Activity after Copy Data activity.
- Configure Delete activity:
- Source dataset:
BlobStorageFiles.
- Use the same file path or parameter to delete files just copied.
- In pipeline, connect Copy Activity success output to Delete Activity.
Step 7: Publish and Trigger Pipeline
- Click Publish All in ADF Studio to save changes.
- Click Add Trigger > Trigger Now to manually run the pipeline.
- Monitor progress in the Monitor tab.
- Confirm files moved/copied successfully into ADLS Gen2.
Additional Notes:
- Ensure the ADF Managed Identity or Service Principal used has appropriate permissions on Blob Storage and ADLS Gen2 (e.g., Read/Write/Delete).
- If files are large or the amount is huge, tweak performance settings like parallel copy, data partitioning.
- You can also parameterize container names, folder paths for more flexible pipelines.
Summary:
| Step | Explanation |
|---|
| Upload files | Manually upload 3 files into Blob Storage container. |
| Create ADF | Provision Azure Data Factory instance. |
| Linked Services | Connect Blob Storage & ADLS Gen2 to ADF. |
| Datasets | Define datasets for source (Blob) and sink (ADLS Gen2). |
| Pipeline + Copy activity | Copy files from Blob Storage to ADLS Gen2. |
| (Optional) ForEach | Loop through specific 3 files if needed. |
| (Optional) Delete Activity | Delete source files after copying (move operation). |
| Publish and Run | Publish pipeline and trigger the run to move files. |
If you'd like, I can also provide:
- Sample JSON snippets for pipeline, datasets, and linked services.
- Screenshots for each step.
Let me know if you want me to prepare the JSON pipeline or further help!