Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello Power BI Community,
I have published a Power BI model using the REST API with an AAD/SPN. However, the model is currently pointing to a Fabric Lakehouse SQL Endpoint, which defaults to single sign-on (SSO). Due to this, I am encountering the following refresh error:
"We cannot refresh this semantic model because this semantic model uses a default data connection without explicit connection credentials. Please replace the default data connection in the semantic model settings with an explicit cloud or gateway data connection."
I have created a connection to the Lakehouse SQL Endpoint and need to update the semantic model connection mapping to use this connection instead of the SSO option.
The issue is that only the SPN has access to the workspace, so I cannot make this change manually. Is there any other way to update the semantic model connection mapping using the REST API or another automated approach?
Any help or guidance would be greatly appreciated!
Thank you.
Solved! Go to Solution.
Hi, @nipunm
Thank you for your prompt response. I now have a better understanding of your requirements and have made timely adjustments to the solution:
1.Firstly, I created the following example, with its relational view as shown below:
It encountered a similar issue to yours:
2.Secondly, we can observe that the creatable gateway connection is a cloud gateway.
Currently, using the API to create a data connection requires a gatewayid, and most REST APIs do not support cloud gateways and virtual gateways. Below is a screenshot from the official documentation:
For further details, please refer to:
Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Therefore, directly using the API to create a data connection is not feasible, which was a misunderstanding on my part regarding your issue.
3.We recommend using the following API to add users to your workspace and manually add the gateway:
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/users
Below is the request body:
{
"emailAddress": "john@contoso.com",
"groupUserAccessRight": "Admin"
}
4.The corresponding content to be added is:
You may need to ensure that your service principal is assigned a role in the workspace where your lakehouse is located.
5.Below are the final results:
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @nipunm
Thanks for reaching out to the Microsoft fabric community forum.
Regarding the issue you raised, my solution is as follows:
1.You may attempt to update the data source credentials using the following API:
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateParameters
2.Below is an example request body:
{
"updateDetails": [
{
"datasourceType": "Sql",
"connectionDetails": {
"server": "your-lakehouse-sql-endpoint-server",
"database": "your-database-name"
},
"credentialDetails": {
"credentialType": "Basic",
"credentials": {
"username": "your-username",
"password": "your-password"
}
}
}
]
}
3.Is that if you are using the Default UpdateDatasources, you may need to pay attention to is:
4.For further details, please refer to:
Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Datasets - Update Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thanks for the response.
Could you please provide any guidance or alternative methods to set/update the credentials for the data source in the Power BI report using the REST API?
Thank you.
Hi, @nipunm
Thank you for your prompt response. I now have a better understanding of your requirements and have made timely adjustments to the solution:
1.Firstly, I created the following example, with its relational view as shown below:
It encountered a similar issue to yours:
2.Secondly, we can observe that the creatable gateway connection is a cloud gateway.
Currently, using the API to create a data connection requires a gatewayid, and most REST APIs do not support cloud gateways and virtual gateways. Below is a screenshot from the official documentation:
For further details, please refer to:
Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Therefore, directly using the API to create a data connection is not feasible, which was a misunderstanding on my part regarding your issue.
3.We recommend using the following API to add users to your workspace and manually add the gateway:
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/users
Below is the request body:
{
"emailAddress": "john@contoso.com",
"groupUserAccessRight": "Admin"
}
4.The corresponding content to be added is:
You may need to ensure that your service principal is assigned a role in the workspace where your lakehouse is located.
5.Below are the final results:
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-linyulu-msft, thanks for doing all the test/POC.
Not adding user to workspace is not a limitation but a requirement, though thanks for the clarification. this will not work for me, but this a workable solution.
Will accept this as Solution, it would be helpful for others.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 |