Certainly! To upload 3 files into Azure Blob Storage and then move them into Azure Data Lake Storage Gen2 (ADLS Gen2) using Azure Data Factory (ADF), you need to follow a multi-step process involving storage setup, ADF pipeline creation, and data movement activities.
Overview of the Process
-
Prerequisites:
- Azure Storage Account (with Blob Storage enabled)
- Azure Data Lake Storage Gen2 (can be enabled on the same storage account or a different one)
- Azure Data Factory instance
- Files to upload on your local machine or accessible location
-
Step 1: Upload files into Blob Storage
-
Step 2: Create Linked Services in ADF for both source (Blob Storage) and sink (ADLS Gen2)
-
Step 3: Create Datasets to point to the files/folders in Blob Storage and ADLS Gen2
-
Step 4: Create Pipeline that copies data from Blob Storage to ADLS Gen2
-
Step 5: Optional - Delete the files from Blob Storage after copy if you want "move" semantics
Detailed Step-By-Step Guide
Prerequisites Setup
-
Azure Storage Account
- If you don’t have one, create it in Azure Portal.
- Enable hierarchical namespace if you want ADLS Gen2 capabilities on the same account.
- If ADLS Gen2 is another account, ensure you have the account key or service principal access.
-
Azure Data Factory instance
- You can create it from the Azure Portal by clicking "Create a resource" → search "Data Factory" → fill details → Create.
Step 1: Upload 3 Files into Blob Storage
You can upload the files via:
Step 2: Create Linked Services in Azure Data Factory
Linked Services are connection strings to your data stores.
- Go to Azure Data Factory portal (ADF Authoring UI)
- Create Linked Service for Blob Storage
- On left pane, click on Manage (gear icon)
- Click Linked services → New
- Search for Azure Blob Storage
- Click Continue
- Provide connection details:
- Connection method: Account key (or Managed Identity or SAS token)
- Account selection method: Select your storage account
- Test connection → Create
- Create Linked Service for Azure Data Lake Storage Gen2
- Same steps as above but select Azure Data Lake Storage Gen2
- Provide endpoint and authentication details.
Step 3: Create Datasets for your source and sink
- Source Dataset (Blob Storage pointing to your 3 files)
- Go to Author (pencil icon)
- Click + (Add new resource) → Dataset
- Select Azure Blob Storage
- Choose format based on your files - e.g., Binary if files are arbitrary or DelimitedText if CSV, etc.
- Choose linked service you created for Blob Storage
- Provide the container and folder path where the 3 files are located
- Use wildcard path or specific files (if you want to select all files in folder use
*)
- Sink Dataset (ADLS Gen2)
- Click + (Add new resource) → Dataset
- Select Azure Data Lake Storage Gen2
- Choose format similar to source or as per your need
- Select linked service created for ADLS Gen2
- Provide folder path where files should be moved/copied to
Step 4: Create Copy Pipeline
- Create pipeline for copy activity
- On left pane, Author → Pipelines → New pipeline
- Give pipeline a name “CopyBlobToADLS”
- Add Copy Data Activity
- Drag Copy data activity from Activities on left to canvas
- Configure copy activity
- Mapping tab
- Unless necessary, auto mapping is fine for binary files.
- Settings tab
- If you want to copy multiple files, make sure "Enable partition discovery" or "Copy recursively" is handled properly.
(Optional) Step 5: Delete Files from Blob Storage after copy (For move semantics)
ADF copy activity only copies; to move files, you need to delete source files after successful copy.
- Use Delete activity after Copy activity in the pipeline:
- Add Delete activity from Activities pane.
- Connect Copy activity’s green arrow to Delete activity --> this will execute deletion after successful copy.
- Configure Delete dataset:
- Use your Blob Storage dataset pointing to the files.
- Use wildcard if multiple files.
- Set delete activity to delete files once copy is complete.
Step 6: Debug and Trigger Pipeline
- Use Debug mode to test pipeline run.
- When confirmed working, create a Trigger:
- Manual Trigger or Scheduled Trigger based on your requirement
- Trigger the pipeline to run
Step 7: Monitor Pipeline Runs
- Use the Monitor tab in ADF UI to check success or failures.
- Logs and stats for each activity provide detailed information on bytes copied, duration, errors, etc.
Summary Table of Key Components
| Step | Azure Data Factory Component | Purpose |
|---|
| Connect to Blob Storage | Linked Service (Blob Storage) | Connect to source storage |
| Connect to ADLS Gen2 | Linked Service (ADLS Gen2) | Connect to sink storage |
| Define data sources | Datasets | Define source files/folders |
| Define data destination | Datasets | Define destination folder |
| Data copy process | Copy Activity | Move files from Blob to ADLS Gen2 |
| (Optional) Delete files | Delete Activity | Remove files from Blob after copy |
| Execution & monitoring | Pipeline + Monitor | Run and track status |
Additional Tips:
- Ensure permissions: The identity used by ADF must have read/list permission on Blob Storage and write permissions on ADLS Gen2.
- If you want automation on file arrival, consider adding Event Trigger based pipelines.
- Use Parameterization in datasets or pipelines if you want dynamic file paths.
- For large files/number of files, consider chunking or staging to optimize performance.
If you want, I can also help provide sample JSON snippets for linked services, datasets, and pipeline activities. Let me know!