Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
UmeshGoti
Helper I
Helper I

While Creating Semantic Layer in directQuery Mode Need to attach with database

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"
]
}
}
]

 

 image.png

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

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,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

5 REPLIES 5
UmeshGoti
Helper I
Helper I

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


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

ibarrau
Super User
Super User

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,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

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

Anonymous
Not applicable

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors