Azure Configuration
Complete guide for configuring Azure Blob Storage and Azure Data Lake Gen2 connectivity with FastBCP.
Supported Azure Storage Services
| Service | Protocol | Best For |
|---|---|---|
| Azure Blob Storage | abs:// | General-purpose object storage |
| Azure Data Lake Gen2 | abfss:// | Big data analytics and hierarchical namespaces |
Authentication Methods
FastBCP supports multiple Azure authentication methods:
- Azure CLI (recommended for local development)
- Connection String (simple but less secure)
- Storage Account Key (via environment variables)
- Managed Identity (recommended for Azure infrastructure)
- SAS URL (scoped, time-limited access)
For direct commit to Azure Blob Storage, FastBCP uses AZURE_STORAGE_CONNECTION_STRING or AZURE_STORAGE_SAS_URL when one of them is set, and falls back to DefaultAzureCredential (Azure CLI, Managed Identity, environment credentials, …) otherwise. The selected authentication method is written to the log.
1. Azure CLI
The simplest method for local development and testing.
Setup:
# Install Azure CLI
# Windows: Download from https://aka.ms/installazurecliwindows
# Linux: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Login to Azure
az login
# List subscriptions
az account list --output table
# Set active subscription (if you have multiple)
az account set --subscription "My Subscription Name"
# or by ID
az account set --subscription "12345678-1234-1234-1234-123456789abc"
# Verify access to storage account
az storage account show --name mystorageaccount --resource-group myresourcegroup
FastBCP will automatically use the Azure CLI's authentication credentials.
Using with FastBCP:
# No additional configuration needed - just run FastBCP
./FastBCP \
...
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports" \
--fileoutput "data.parquet" \
...
2. Connection String
Useful for CI/CD pipelines and automated workflows.
Get Connection String:
- Azure Portal
- Azure CLI
- Navigate to your Storage Account
- Go to Security + networking → Access keys
- Copy the Connection string for key1 or key2
az storage account show-connection-string \
--name mystorageaccount \
--resource-group myresourcegroup \
--output tsv
Set Connection String:
- Windows (PowerShell)
- Linux/macOS
$env:AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=xxxxx;EndpointSuffix=core.windows.net"
# Run FastBCP
.\FastBCP.exe `
...
--directory "abs://mystorageaccount.blob.core.windows.net/container/exports" `
--fileoutput "data.parquet" `
...
export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=xxxxx;EndpointSuffix=core.windows.net"
# Run FastBCP
./FastBCP \
...
--directory"abs://mystorageaccount.blob.core.windows.net/mycontaner/exports" \
--fileoutput "data.parquet" \
...
3. Storage Account Key
Alternative to connection string using separate environment variables.
Get Storage Account Key:
- Azure Portal
- Azure CLI
- Navigate to your Storage Account
- Go to Security + networking → Access keys
- Copy key1 or key2
az storage account keys list \
--account-name mystorageaccount \
--resource-group myresourcegroup \
--query "[0].value" \
--output tsv
Set Environment Variables:
- Windows (PowerShell)
- Linux/macOS
$env:AZURE_CLIENT_ID="<ClientID>"
$env:AZURE_TENANT_ID="<TenantId>"
$env:AZURE_CLIENT_SECRET="<SecretID>"
# Run FastBCP
.\FastBCP.exe `
...
--directory "abs://mystorageaccount.blob.core.windows.net/mycontaner/exports" `
--fileoutput "data.parquet" `
...
export AZURE_CLIENT_ID="<ClientID>"
export AZURE_TENANT_ID="<TenantId>"
export AZURE_CLIENT_SECRET="<SecretID>"
# Run FastBCP
./FastBCP \
...
--directory "abs://mystorageaccount.blob.core.windows.net/mycontaner/exports" \
--fileoutput "data.parquet" \
...
4. Managed Identity
When FastBCP runs on Azure infrastructure, it can use Managed Identity automatically. No credentials configuration needed!
Supported Azure Services:
- Azure Virtual Machines
- Azure App Service
- Azure Functions
- Azure Container Instances
- Azure Kubernetes Service (AKS)
Enable System-Assigned Managed Identity:
- Azure Portal
- Azure CLI
- Navigate to your Azure resource (VM, App Service, etc.)
- Go to Identity
- Enable System assigned identity
- Save changes
# For a VM
az vm identity assign --name myVM --resource-group myResourceGroup
# For an App Service
az webapp identity assign --name myAppService --resource-group myResourceGroup
Grant Storage Access:
# Get the Managed Identity Object ID
PRINCIPAL_ID=$(az vm show --name myVM --resource-group myResourceGroup --query identity.principalId -o tsv)
# Assign Storage Blob Data Contributor role
az role assignment create \
--assignee $PRINCIPAL_ID \
--role "Storage Blob Data Contributor" \
--scope "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}"
5. SAS URL
Since FastBCP 1.3, you can authenticate to Azure Blob Storage with a Shared Access Signature (SAS) URL, set in the AZURE_STORAGE_SAS_URL environment variable. A SAS grants scoped, time-limited access without sharing the account key.
Generate a container SAS URL:
- Azure Portal
- Azure CLI
- Navigate to your Storage Account → Containers → your container
- Go to Shared access tokens
- Select the Create and Write permissions and an expiry date
- Click Generate SAS token and URL and copy the Blob SAS URL
az storage container generate-sas \
--account-name mystorageaccount \
--name mycontainer \
--permissions cw \
--expiry 2026-12-31T23:59Z \
--auth-mode key \
--output tsv
# Then build the URL: https://mystorageaccount.blob.core.windows.net/mycontainer?<sas-token>
Set the SAS URL:
- Windows (PowerShell)
- Linux/macOS
$env:AZURE_STORAGE_SAS_URL="https://mystorageaccount.blob.core.windows.net/mycontainer?sv=...&sig=..."
# Run FastBCP
.\FastBCP.exe `
...
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports" `
--fileoutput "data.parquet" `
...
export AZURE_STORAGE_SAS_URL="https://mystorageaccount.blob.core.windows.net/mycontainer?sv=...&sig=..."
# Run FastBCP
./FastBCP \
...
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports" \
--fileoutput "data.parquet" \
...
Quote the SAS URL: it contains & characters that the shell would otherwise interpret.
Azure Blob Storage
URI Format
abs://storageaccount.blob.core.windows.net/container/path/
URI Examples
# Root of container
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/"
# Folder in container
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports"
# Nested folders
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports/sales/2024"
# Date partitioning
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/yearmonth=202401/"
Complete Examples
Basic Export:
- Windows
- Linux
.\FastBCP.exe `
--connectiontype "mssql" `
--server "localhost" `
--database "SalesDB" `
--trusted `
--sourceschema "dbo" `
--sourcetable "Customers" `
--directory "abs://mystorageaccount.blob.core.windows.net/mycontainer/exports/customers" `
--fileoutput "customers.parquet"
./FastBCP \
--connectiontype "mssql" \
--server "localhost" \
--database "SalesDB" \
--trusted \
--sourceschema "dbo" \
--sourcetable "Customers" \
--directory "abs://mystorageaccount.blob.core.windows.net/container/exports/customers" \
--fileoutput "customers.parquet"
Parallel Export with Query:
- Windows
- Linux
.\FastBCP.exe `
--connectiontype "pgsql" `
--server "localhost" `
--port "5432" `
--database "ecommerce" `
--user "postgres" `
--password "postgres" `
--query "SELECT * FROM orders WHERE order_date >= '2024-01-01'" `
--directory "abs://mystorageaccount.blob.core.windows.net/container/exports/orders" `
--fileoutput "orders_2024.parquet" `
--parallelmethod "Random" `
--distributekeycolumn "order_id" `
--paralleldegree 8
./FastBCP \
--connectiontype "pgsql" \
--server "localhost" \
--port "5432" \
--database "ecommerce" \
--user "postgres" \
--password "postgres" \
--query "SELECT * FROM orders WHERE order_date >= '2024-01-01'" \
--directory "abs://mystorageaccount.blob.core.windows.net/container/exports/orders" \
--fileoutput "orders_2024.parquet" \
--parallelmethod "Random" \
--distributekeycolumn "order_id" \
--paralleldegree 8
Azure Data Lake Gen2
Azure Data Lake Storage Gen2 is recommended for analytics workloads due to hierarchical namespace support and better performance.
URI Format
abfss://container@storageaccount.dfs.core.windows.net/path/
- Protocol:
abfss://instead ofabs:// - Endpoint:
.dfs.core.windows.netinstead of.blob.core.windows.net - Features: Hierarchical namespace, directory-level operations, better performance
URI Examples
# Root of filesystem
--directory "abfss://mystorageaccount.dfs.core.windows.net/datalake"
# Folder in filesystem
--directory "abfss://mystorageaccount.dfs.core.windows.net/datalake/raw/sales"
# Hive-style partitioning
--directory "abfss://mystorageaccount.dfs.core.windows.net/datalake/sales/yearmonth=202401"
Complete Examples
Basic Export:
- Windows
- Linux
.\FastBCP.exe `
--connectiontype "mssql" `
--server "localhost" `
--database "DataWarehouse" `
--trusted `
--sourceschema "dbo" `
--sourcetable "FactSales" `
--directory "abfss://mystorageaccount.dfs.core.windows.net/datalake/raw/{sourcetable}/" `
--fileoutput "FactSales.parquet"
./FastBCP \
--connectiontype "mssql" \
--server "localhost" \
--database "DataWarehouse" \
--trusted \
--sourceschema "dbo" \
--sourcetable "FactSales" \
--directory "abfss://datalake@mystorageaccount.dfs.core.windows.net/raw/{sourcetable}/" \
--fileoutput "FactSales.parquet"
Parallel Export with Partitioning:
- Windows
- Linux
.\FastBCP.exe `
--connectiontype "mssql" `
--server "localhost" `
--database "Analytics" `
--trusted `
--query "SELECT * FROM Events" `
--directory "abfss://mystorageaccount.dfs.core.windows.net/mycontainer/{sourcedatabase}/events/" `
--fileoutput "events.parquet" `
--parallelmethod "DataDriven" `
--distributekeycolumn "EventDate" `
--datadrivenquery "SELECT RefDate From Calendar WHERE RefDate between '2024-01-01' and '2024-03-01'" `
--paralleldegree 12
./FastBCP \
--connectiontype "mssql" \
--server "localhost" \
--database "Analytics" \
--trusted \
--query "SELECT * FROM Events" \
--directory "abfss://mystorageaccount.dfs.core.windows.net/mycontainer/{sourcedatabase}/events/" \
--fileoutput "events.parquet" \
--parallelmethod "DataDriven" \
--distributekeycolumn "EventDate" \
--datadrivenquery "SELECT RefDate From Calendar WHERE RefDate between '2024-01-01' and '2024-03-01'" \
--paralleldegree 12
Required Permissions
Azure RBAC Roles
Recommended Role:
- Storage Blob Data Contributor - Full read/write access to blobs
Alternative Roles:
- Storage Blob Data Owner - Full access including ACL management
- Storage Blob Data Reader - Read-only access (for verification)
Container Access
FastBCP creates the target container if it does not exist. When the container already exists, a missing permission to create it (HTTP 403 or 409 on the create call) is tolerated, so an identity or SAS that can only write blobs into an existing container is enough.
Troubleshooting 403 Errors
A 403 Forbidden from Azure Storage usually comes from one of the following:
- Firewall: the storage account's network rules do not allow the IP address or virtual network FastBCP runs from.
- RBAC: the identity used by
DefaultAzureCredentialhas no data-plane role (such as Storage Blob Data Contributor) on the account or container. Management roles such as Owner or Contributor are not enough. Role assignments can take a few minutes to apply. - SAS permissions: the SAS token is expired, is scoped to another container, or lacks the Create / Write permissions.
FastBCP logs the authentication method it used, which helps tell these cases apart.
Assign Role via Azure Portal
- Navigate to your Storage Account
- Go to Access Control (IAM)
- Click Add → Add role assignment
- Select Storage Blob Data Contributor
- Select user, group, or managed identity
- Click Save
Assign Role via Azure CLI
# For a user
az role assignment create \
--assignee user@example.com \
--role "Storage Blob Data Contributor" \
--scope "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}"
# For a managed identity
az role assignment create \
--assignee {managed-identity-object-id} \
--role "Storage Blob Data Contributor" \
--scope "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}"