Azure Data Factory: How to split a file into multiple output files with Bicep
Introduction
In this article we will see how to split a csv file located in an Azure Storage Account through Azure Data Factory Data Flow.
We will do it through Azure Bicep in order to demonstrate the benefits of Infrastructure as Code (IaC) including:
- Reviewing the planned infrastructure that will be deployed through the what-if feature.
- Reproducible and testable infrastructures with templating deployments.
A complete procedure to deploy the following resources is available here: https://github.com/JamesDLD/bicep-data-factory-data-flow-split-file
- Azure Storage Account
- Uploading a test file that will be splitted
- Azure Data Factory
- Azure Data Factory Linked Service to connect Data Factory to our Storage Account
- Azure Data Factory Data Flow that will split our file
- Azure Data Factory Pipeline to trigger our Data Flow
- Bonus: Azure Data Factory Pipeline to cleanup the output container for your demos
Bicep code to create our linked service
The following Bicep code demonstrates how to create a Storage Account Linked Service through Azure Bicep.
Every body might not be concerned by the following limitation but in order to make this demo accessible to everyone we will create the Storage Account linked service through a connection string instead of using a managed identity which is definitely what I usually recommend.
If your blob account enables soft delete, system-assigned/user-assigned managed identity authentication isn’t supported in Data Flow.
If you access the blob storage through private endpoint using Data Flow, note when system-assigned/user-assigned managed identity authentication is used Data Flow connects to the ADLS Gen2 endpoint instead of Blob endpoint. Make sure you create the corresponding private endpoint in ADF to enable access.
Source: Data Flow/User-assigned managed identity authentication
Let’s have a look at the Bicep code!
The only trick here is to grab an existing storage account and pass its connection string through Bicep without having any secret in your code.
Bicep code to create our Azure Data Factory Data Flow
Based on the following reference “Microsoft.DataFactory factories/linkedservices” we will create the Azure Data Factory Data Flow that will split our file into multiple files.
When using the az deployment what-if option we can see the following changes. This is really convenient to see the asked changes before applying them.
The Data Flow looks like the following screenshot where we can see the number of partition that will be created. In our context it corresponds to the number of csv files that will be generated from our input csv file.
The other trick here is to play with a file name pattern to manage the target files names.
The output files in this sample will be set to fit with the input file name, the current date and the output file iteration.
Split the file through the Pipeline
Through the procedure located here https://github.com/JamesDLD/bicep-data-factory-data-flow-split-file we have created an Azure Data Factory pipeline named “ArmtemplateSampleSplitFilePipeline”, you can trigger it to launch the Data Flow that will split the file.
The following screenshot illustrates the split result done through Azure Data Factory Data Flow.
Conclusion
Considering Bicep or any other Infrastructure as Code (IaC) tool ensures to gain efficiency and agility, its a real ramp up when designing infrastructures and it makes them reproducible and testable.
See You in the Cloud
Jamesdld
Published on:
Learn moreRelated posts
Microsoft Purview compliance portal: Endpoint DLP classification support for Azure RMS–protected Office documents
Microsoft Purview Endpoint DLP will soon classify Azure RMS–protected Office documents, enabling consistent DLP policy enforcement on encrypte...
Introducing the Azure Cosmos DB Plugin for Cursor
We’re excited to announce the Cursor plugin for Azure Cosmos DB bringing AI-powered database expertise, best practices guidance, and liv...
Azure DevOps Remote MCP Server (public preview)
When we released the local Azure DevOps MCP Server, it gave customers a way to connect Azure DevOps data with tools like Visual Studio and Vis...
Azure Cosmos DB at FOSSASIA Summit 2026: Sessions, Conversations, and Community
The FOSSASIA Summit 2026 was an incredible gathering of developers, open-source contributors, startups, and technology enthusiasts from across...
Dataverse: Avoid Concurrency issues by using Azure Service Bus Queue and Azure Functions
Another blog post to handle the concurrency issue. Previously, I shared how to do concurrency via a plugin in this blog post and also how to f...
March Patches for Azure DevOps Server
We are releasing patches for our self‑hosted product, Azure DevOps Server. We strongly recommend that all customers stay on the latest, most s...
Azure Developer CLI (azd): Debug hosted AI agents from your terminal
New azd ai agent show and monitor commands help you diagnose hosted AI agent failures directly from the CLI. The post Azure Developer CLI (azd...
A Look Ahead at Azure Cosmos DB Conf 2026: From AI Agents to Global Scale
Join us for Azure Cosmos DB Conf 2026, a free global, virtual developer event focused on building modern applications with Azure Cosmos DB. Da...
Announcing general availability of Azure Confidential Computing (ACC) virtual machines for U.S. government environments
Government agencies have an increased need for secure, verifiable, and compliant cloud environments that adhere to data sovereignty regulation...