Forum Discussion

DanrleiAlves's avatar
DanrleiAlves
New Member
1 year ago
Solved

Getting DataSource Metadata from datasourceId

Hi all, 


I want to get datasource details (database name, table name) from the datasoureceID, gatewayID or datasourceuniqueID.


I have access to the admin APIs, but couldnt figure out a way to get further detail from the datasources through using the datasourceIDs.

 

The datasource is a synapse data lakehouse, the dashboards connect to synapse tables/views.

  • v-lgarikapat's avatar
    v-lgarikapat
    1 year ago

    Hi DanrleiAlves ,

    Thank you for sharing the error screenshot and for the detailed explanation.

    Could you please try the following troubleshooting steps

     

    Start by checking your gateway permissions. In the Power BI Service, go to Manage Gateways, find the relevant gateway, and make sure your account or service principal is listed with Admin or Manage access under the Users tab for that datasource. Next, check that your token includes the necessary scopes like Dataset.Read.All and Gateway.Read.All you may also need Tenant.Read.All for broader access. If you're using a service principal, ensure it has been granted access in the Admin Portal. Finally, to confirm the datasource ID, use the API call GET /gateways/{gatewayId}/datasources to list all datasources connected to the gateway

    Troubleshoot gateways - Power BI | Microsoft Learn

    We truly appreciate your continued engagement and thank you for being an active and valued member of the community.

    If you're still experiencing any challenges, please don’t hesitate to reach out  we’d be more than happy to assist you further.

    We look forward to hearing from you.

    Best regards,
    Lakshmi

     

6 Replies

  • v-lgarikapat's avatar
    v-lgarikapat
    Community Support

    Hi DanrleiAlves ,

    Thanks for reaching out to the Microsoft Fabric community forum!

     

    To retrieve database and table details from a datasource, especially for Synapse Lakehouse connections, you can start with the Gateway Datasource API:

    Dataflows - Get Dataflow Data Sources - REST API (Power BI Power BI REST APIs) | Microsoft Learn

     

    If you're trying to extract used tables and fields, check out this community thread Solved: Using Power BI REST API to get list of used tables... - Microsoft Fabric Community it discusses using the Scanner API to get dataset-level metadata like tables, columns, and measures.

     

    We truly appreciate your continued engagement and thank you for being an active and valued member of the community.

    If you're still experiencing any challenges, please don’t hesitate to reach out — we’d be more than happy to assist you further.

    We look forward to hearing from you.

    Best regards,
    Lakshmi

    • DanrleiAlves's avatar
      DanrleiAlves
      New Member

      Thanks for the fast reply.

       

      The Dataflows endpoint suggested doesnt give the table name. Gives only the database (in my case everything is in serverless, so not much useful).

      The connection path would give all the information im looking for. But i havent been able to figure out a way to get to that information

       

      I thought of using this endpoint https://api.powerbi.com/v1.0/myorg/admin/gateways/{{gatewayId}}/datasources/{{datasourceid}}

      based on this doc. Gateways - Get Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn

      to provide the GatewayID and DatasourceID and hopefully get the path information i need.

       

      But im getting this issue:

      Any idea what this might be? Thanks in advance!

      • v-lgarikapat's avatar
        v-lgarikapat
        Community Support

        Hi DanrleiAlves ,

        Thank you for sharing the error screenshot and for the detailed explanation.

        Could you please try the following troubleshooting steps

         

        Start by checking your gateway permissions. In the Power BI Service, go to Manage Gateways, find the relevant gateway, and make sure your account or service principal is listed with Admin or Manage access under the Users tab for that datasource. Next, check that your token includes the necessary scopes like Dataset.Read.All and Gateway.Read.All you may also need Tenant.Read.All for broader access. If you're using a service principal, ensure it has been granted access in the Admin Portal. Finally, to confirm the datasource ID, use the API call GET /gateways/{gatewayId}/datasources to list all datasources connected to the gateway

        Troubleshoot gateways - Power BI | Microsoft Learn

        We truly appreciate your continued engagement and thank you for being an active and valued member of the community.

        If you're still experiencing any challenges, please don’t hesitate to reach out  we’d be more than happy to assist you further.

        We look forward to hearing from you.

        Best regards,
        Lakshmi