Forum Discussion
Mahee
1 year agoRegular Visitor
Power BI to Azure SQL MI Connection via Power Query Parameters
Hi All, Good Day! We have a Power Query parameter for Server (Azure SQL MI) and Database. Once we create and try to save it with credentials, It is throwing an error. But the same server and D...
- 1 year ago
Hello Mahee ,
Power BI does not allow credentials to be saved for dynamic data source references (i.e., server/database coming from parameters), unless you're using an on-prem gateway. This is why it works for on-prem SQL (via Gateway) but not for Azure SQL MI without one.When you use Power Query parameters directly in your SQL Server connector like this:
Sql.Database(ServerParam, DatabaseParam)Power BI considers this a "dynamic data source", and dynamic data sources prevent credential storage or scheduled refresh in many cases.
Limitation: Power BI cannot associate credentials with a dynamic value for server/database unless it's marked as a gateway allowed data source with fixed metadata.To avoid dynamic binding issues:Instead of:
Sql.Database(ServerParam, DatabaseParam)Use:
let
Source = Sql.Database("your-server.database.windows.net", "your-db-name")
in
SourceThen use parameters only within queries (e.g., for schema/table filtering), not for the source connection string.
If this solved your issue, please mark it as the accepted solution. ✅
rohit1991
1 year agoSuper User
Hi Mahee
Yes, this is a known limitation in Power BI. When using Power Query parameters for Azure SQL MI (like passing server or database name dynamically), Power BI can't bind credentials properly that's why the connection fails. It works in SSMS because it doesn’t have this restriction.
To confirm, try hardcoding the server and database if that works, the issue is with dynamic parameters. As a workaround, avoid passing parameters directly into Sql.Database() for cloud sources like Azure SQL MI.