Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

How to connect Power BI Service to an API with separate token authentication using service principal

Question: We're working on integrating Power BI with a REST API that requires authentication via a service principal (client ID and secret). However, the setup has some challenges: The token endp...
  • v-sgandrathi's avatar
    1 year ago

    Hi Anonymous,

    Try the below suggestion:

    To avoid using an on-premises data gateway, you can use Azure Functions or Logic Apps as a secure middleware proxy. This setup allows Power BI to connect to a single, simplified public endpoint.

    The Azure Function handles the complex parts: it first calls the token endpoint using client credentials, gets the access token, then makes the actual API request with the required headers, and finally returns clean JSON data to Power BI.

    In Power BI, you just use a basic Web.Contents() call to the Azure Function URL with anonymous authentication, since all authentication logic is handled within the Azure Function itself. To keep it secure, you should store secrets in Azure Key Vault or the function’s App Settings, and protect the function using an API key or IP restrictions.

    This method ensures secure, reliable, and gateway-free scheduled refresh in Power BI Service.

     

    If my response was helpful, consider clicking "Accept as Solution" and give us "Kudos" so that other community members can find it easily. Let me know if you need any more assistance!

     

    Thanks for using Microsoft Fabric Community Forum.