Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hello Community,
As part of report migration project from other technologies to PowerBi. i am using Fabric Rest APIs (https://learn.microsoft.com/en-us/rest/api/fabric/semanticmodel/items/create-semantic-model?tabs=HTT...)
to create semantic layer in directQuery Mode.
And i am using below "model.bim" JSON configuration for connecting with database
but here i don't see any option to provide database username and password
so when i open this dataset from power bi service it gives popup like "The datasource is missing credentials and cannot be accessed"
now my requirement is somehow i need to pass database username and password along with model.bim JSON
so semantic layer will already get connected with database and we can create visual report directly
"partitions": [{
"name": "Applications",
"mode": "directQuery",
"source": {
"type": "m",
"expression": [
"let",
" Source = Sql.Database(\"xxx-xxxx..database.windows.net\", \"database_name\"),",
" dbo_Applications = Source{[Schema=\"dbo\",Item=\"country\"]}[Data]",
"in",
" dbo_Applications"
]
}
}
]
Solved! Go to Solution.
Hi. Like the UI after you publish a new semantic model, the first thing would be edit it's credentials at the settings of configure a gateway. Using the API for changing data source or creating a new semantic model is the same here. Until a month or two it was mandatory to do it at the UI. Nowadays there is a Fabric Rest API request that might let you write the credentials. I haven't tested yet how it works but I know it's preview. You can try it if you want to keep all in code: https://learn.microsoft.com/en-us/rest/api/fabric/core/connections/update-connection?tabs=HTTP
I hope that helps,
Happy to help!
Thanks @ibarrau for your suggestions
i am trying to explore update connection api there we need to pass connection id
but in our case i have created semantic layer so i have dataset id that's where not getting idea what connection id we need to pass to update database credentials in created semantic layer
let me know if you could find something !! that will help me a lot
Thanks in Advance !!!
You can check all the connections your users can see with: https://learn.microsoft.com/en-us/rest/api/fabric/core/connections/list-connections?tabs=HTTP
Find the id of the one you want to change credentials and update connection.
I hope that make sense
Happy to help!
Hi. Like the UI after you publish a new semantic model, the first thing would be edit it's credentials at the settings of configure a gateway. Using the API for changing data source or creating a new semantic model is the same here. Until a month or two it was mandatory to do it at the UI. Nowadays there is a Fabric Rest API request that might let you write the credentials. I haven't tested yet how it works but I know it's preview. You can try it if you want to keep all in code: https://learn.microsoft.com/en-us/rest/api/fabric/core/connections/update-connection?tabs=HTTP
I hope that helps,
Happy to help!
Hi @UmeshGoti,
we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
Vinay Pabbu
Hi @UmeshGoti,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Regards,
Vinay Pabbu
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!