Only in Mage Pro.Try our fully managed solution to access this advanced feature.

Overview
Microsoft Fabric Warehouse is a fully managed, cloud-native data warehouse built on Azure Synapse SQL. It provides enterprise-grade performance, scalability, and security for your data analytics workloads. This integration allows you to connect to Microsoft Fabric Data Warehouse using Azure AD Service Principal authentication and perform SQL operations directly from Mage pipelines.Add credentials
- Create a new pipeline or open an existing pipeline.
- Expand the left side of your screen to view the file browser.
- Scroll down and click on a file named
io_config.yaml
. - Enter the following keys and values under the key named
default
(you can have multiple profiles, add it under whichever is relevant to you)
Configuration Parameters
Parameter | Description | Required | Example |
---|---|---|---|
AZURE_CLIENT_ID | Azure AD Service Principal Application ID (GUID format) | ✅ | 12345678-1234-1234-1234-123456789012 |
AZURE_CLIENT_SECRET | Azure AD Service Principal Secret | ✅ | your-secret-here |
MICROSOFT_FABRIC_WAREHOUSE_NAME | Name of your Fabric Data Warehouse database | ✅ | my_database |
MICROSOFT_FABRIC_WAREHOUSE_ENDPOINT | Fabric workspace endpoint URL | ✅ | abcde12345.datawarehouse.fabric.microsoft.com |
MICROSOFT_FABRIC_WAREHOUSE_SCHEMA | Default schema for operations | ❌ | dbo (default) |
Service Principal Setup
To use service principals with Microsoft Fabric Data Warehouse, you need to:- Create a service principal in Microsoft Entra ID
- Enable service principal access in Microsoft Fabric
- Assign appropriate permissions to the service principal
- Register a Microsoft Entra app and create a service principal
- Service principal in Fabric Data Warehouse
Using Python block
- Create a new pipeline or open an existing pipeline.
- Add a data loader, transformer, or data exporter block (the code snippet below is for a data loader).
- Select
Generic (no template)
. - Enter this code snippet (note: change the
config_profile
fromdefault
if you have a different profile):
- Run the block.
Export a dataframe
Here is an example code snippet to export a dataframe to Microsoft Fabric Warehouse:Custom types
To overwrite a column type when running a python export block, simply specify the column name and type in theoverwrite_types
dict in data exporter config:
Troubleshooting errors
Connection Timeout Errors
Error:Login timeout expired
or Connection timeout
“Verify your Service Principal credentials and network connectivity”
- Ensure
AZURE_CLIENT_ID
is a valid GUID format - Verify
AZURE_CLIENT_SECRET
is correct and not expired - Check that the Service Principal has appropriate permissions on your Fabric workspace
- Ensure the Service Principal is not disabled in Azure AD
- Verify network connectivity to the endpoint
- Check if corporate firewall or proxy is blocking the connection
- Try increasing connection timeout settings
TCP Provider Errors
Error:TCP Provider: Error code 0x2746 (10054)
or Connection reset by peer
“Verify your endpoint URL and network connectivity”
- Ensure
MICROSOFT_FABRIC_WAREHOUSE_ENDPOINT
is correct and accessible - Check network connectivity to the endpoint (ping, telnet, etc.)
- Verify the endpoint is accessible from your current location
- Ensure the endpoint is not blocked by firewall rules
- Check if Azure region is experiencing connectivity issues
- Verify the Microsoft Fabric service is operational
- Try connecting from a different network to isolate the issue
Database Object Errors
Error:Invalid object name 'table_name'
or Database 'database_name' does not exist
“Verify your database name, schema, and table existence”
- Ensure
MICROSOFT_FABRIC_WAREHOUSE_NAME
matches exactly (case-sensitive) - Check that the Service Principal has access to the database
- Verify the database exists in your Fabric workspace
- Ensure the database is not paused or offline
- Verify the table exists in the specified schema
- Check if you’re using the correct schema name (default is ‘dbo’)
- Ensure table names are properly quoted if they contain special characters
Authentication Errors
Error:Failed to authenticate with Azure AD
or Login failed for user
“Verify your Service Principal credentials and permissions”
- Ensure
AZURE_CLIENT_ID
is a valid GUID format - Verify
AZURE_CLIENT_SECRET
is correct and not expired - Check that the Service Principal has appropriate permissions on your Fabric workspace
- Ensure the Service Principal is not disabled in Azure AD
- Verify the Service Principal has the correct role assignments
- Check if the Service Principal’s permissions have been revoked
Schema Errors
Error:Schema 'schema_name' does not exist
“Verify your schema name and permissions”
- Ensure
MICROSOFT_FABRIC_WAREHOUSE_SCHEMA
is correct - Check that the Service Principal has access to the schema
- Verify the schema exists in your database
- Use ‘dbo’ as the default schema if unsure
- Check if the schema name is case-sensitive
- Verify the Service Principal has CREATE/ALTER permissions on the schema
Best Practices
-
Service Principal Management:
- Use dedicated Service Principals for different environments
- Rotate secrets regularly
- Grant minimum required permissions
-
Connection Management:
- Always use context managers (
with
statements) when possible - Close connections explicitly when not using context managers
- Test connections before running large operations
- Always use context managers (
-
Performance Optimization:
- Use appropriate
if_exists
policies (‘replace’, ‘append’, ‘fail’) - Consider using
overwrite_types
for optimal column types - Use LIMIT clauses in queries when testing
- Use appropriate
-
Security:
- Never hardcode credentials in your code
- Use
io_config.yaml
for all configuration - Ensure
io_config.yaml
is not committed to version control - Use environment variables for sensitive values in production