What we're setting up
ποΈsql-shopkart-dev
Azure SQL: the app's orders
π¦stsupplierdrop
Supplier's Blob container: daily CSVs
πadf-shopkart-dev
The factory, with a managed identity
πstshopkartdev
ADLS Gen2 lake: container 'lake'
Names follow a common convention: resource type prefix (rg-, adf-, st, kv-), project, environment. Storage account names must be lowercase letters and numbers only.
Step 1: create the resources
In the Azure portal (or with the Azure CLI below):
| Resource | Key settings |
|---|---|
| Resource group rg-shopkart-dev | Region: Central India (close to the data and users) |
| Storage account stshopkartdev | Hierarchical namespace: ON (makes it ADLS Gen2). Container: lake |
| Key Vault kv-shopkart-dev | Permission model: Azure role-based access control |
| Data factory adf-shopkart-dev | Version V2; Git: configure later (lesson 11) |
$az group create --name rg-shopkart-dev --location centralindia$az storage account create --name stshopkartdev --resource-group rg-shopkart-dev \$ --sku Standard_LRS --kind StorageV2 --hns true$az keyvault create --name kv-shopkart-dev --resource-group rg-shopkart-dev --enable-rbac-authorization true$az datafactory create --name adf-shopkart-dev --resource-group rg-shopkart-dev --location centralindia
Step 2: give the factory an identity, not passwords
Every factory gets a system-assigned managed identity, an Entra ID identity named like the factory. You grant it roles, and ADF uses it to sign in:
| Grant the factory's identity | On | So it can |
|---|---|---|
| Storage Blob Data Contributor | stshopkartdev (the lake) | Read and write lake files |
| Key Vault Secrets User | kv-shopkart-dev | Read secrets at run time |
| A database user (CREATE USER [adf-shopkart-dev] FROM EXTERNAL PROVIDER) | sql-shopkart-dev | Read orders, run the watermark procedure |
{
"name": "adf-shopkart-dev",
"location": "centralindia",
"properties": {
"globalParameters": {
"env": {
"type": "String",
"value": "dev"
},
"alertWebhookUrl": {
"type": "String",
"value": "https://example.com/hooks/shopkart-alerts"
}
}
},
"identity": {
"type": "SystemAssigned"
}
}The factory file also holds global parameters: values every pipeline can read, like env and the alert webhook. In lesson 11 they change per environment (dev/test/prod) during deployment.
Step 3: linked services
In ADF Studio: Manage β Linked services β New, pick the connector, fill in the form. The JSON it saves:
{
"name": "LS_ADLS_ShopKart",
"properties": {
"description": "The data lake (ADLS Gen2). Managed identity with the Storage Blob Data Contributor role.",
"type": "AzureBlobFS",
"typeProperties": {
"url": "https://stshopkartdev.dfs.core.windows.net/"
}
}
}{
"name": "LS_KeyVault",
"properties": {
"type": "AzureKeyVault",
"typeProperties": {
"baseUrl": "https://kv-shopkart-dev.vault.azure.net/"
}
}
}| Linked service | Connector type | Authentication |
|---|---|---|
| LS_AzureSql_ShopKart | AzureSqlDatabase | Managed identity |
| LS_ADLS_ShopKart | AzureBlobFS (ADLS Gen2) | Managed identity |
| LS_Blob_Supplier | AzureBlobStorage | Connection string from Key Vault (it's the supplier's account) |
| LS_KeyVault | AzureKeyVault | Managed identity |
Use Test connection in Studio before saving. Most failures are missing roles or firewalls.
Step 4: reusable datasets
A Parquet dataset for anywhere in the lake, with the folder and file as parameters:
{
"name": "DS_ADLS_Parquet",
"properties": {
"linkedServiceName": {
"referenceName": "LS_ADLS_ShopKart",
"type": "LinkedServiceReference"
},
"parameters": {
"folderPath": {
"type": "string"
},
"fileName": {
"type": "string"
}
},
"type": "Parquet",
"typeProperties": {
"location": {
"type": "AzureBlobFSLocation",
"fileName": {
"value": "@dataset().fileName",
"type": "Expression"
},
"folderPath": {
"value": "@dataset().folderPath",
"type": "Expression"
},
"fileSystem": "lake"
},
"compressionCodec": "snappy"
},
"schema": []
}
}And a SQL dataset with no table at all, because our activities always send their own query:
{
"name": "DS_AzureSql_Query",
"properties": {
"description": "Any query against the app database (the query is set in the activity).",
"linkedServiceName": {
"referenceName": "LS_AzureSql_ShopKart",
"type": "LinkedServiceReference"
},
"type": "AzureSqlTable",
"schema": [],
"typeProperties": {}
}
}Networking in one paragraph
By default the Azure integration runtime reaches stores over public endpoints, so storage and SQL firewalls must allow βtrusted Azure servicesβ or the runtime. Companies that block public access use a managed virtual network with managed private endpoints (traffic stays on Microsoft's private network), or a self-hosted IR inside their own network.
π― Interview questions on this topic
Try to answer out loud first, then tap to check.
Q1How do you store credentials securely in ADF?Fresher+
Q2System-assigned vs user-assigned managed identity?1β3 yrs+
Q3ADF can't connect to a storage account with 'public network access disabled'. Options?1β3 yrs+
Q4How do you make linked services work across dev, test and prod?3+ yrs+
Key takeaways
- βIdentity first: managed identity plus roles beats passwords.
- βKey Vault for the secrets you can't avoid.
- βGeneric, parameterized datasets keep the factory small.
- βPlan networking early if your company blocks public access.
Frequently asked questions
What is a managed identity in ADF?
An identity in Microsoft Entra ID that Azure creates for your factory automatically. You give it roles on resources (for example Storage Blob Data Contributor on the lake), and ADF signs in as itself. No passwords or keys to store, rotate or leak.
Why use Key Vault with ADF?
For secrets you can't avoid (a partner's connection string, an API key). The secret stays in Key Vault; the linked service only references its name, and the factory's managed identity reads it at run time. Rotate the secret in Key Vault and nothing in ADF changes.
Which region should I create the factory in?
Close to your data, to reduce latency and data transfer cost. The factory's region is where its metadata is stored; the Azure integration runtime can auto-resolve to run copies near the data.
ADLS Gen2 or Blob Storage for the lake?
ADLS Gen2: it's a storage account with the hierarchical namespace turned on, giving real folders and folder-level permissions, which data lakes need. ADF connects with the Azure Data Lake Storage Gen2 connector (type AzureBlobFS).
π§ Quick check: ADF setup
1. Best way for ADF to access the data lake?
2. What does a Key Vault reference in a linked service contain?
3. ADLS Gen2 is...
4. Which role lets the factory read and write lake files?
Checking your accessβ¦