Forum Discussion
created a custom connector to call a API using oauth: received 403 as response.
- 9 months ago
Hi aykhandelwal,
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to vojtechsima, for his inputs on this thread.
From your description, it looks like you are trying to call an Azure-hosted API from Power BI using OAuth authentication. Since you’re getting a 403 (Forbidden) response, it typically indicates that the token being used doesn’t have the right permissions or configuration to access the API.
To resolve this, you will need to ensure your Azure AD app registrations and Power BI connector are correctly set up for OAuth2. Here are the steps might be helpfulExpose your API in Azure AD: In the Azure Portal, go to App registrations → your API app → Expose an API. Define an App ID URI (e.g., api://<your-api-client-id>) and add a scope (for example, api.read).
https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-configure-app-expose-web-apisRegister your Power BI client app: Create (or use an existing) App registration for Power BI. Under API Permissions, add delegated permission to your API (e.g., api.read). Grant admin consent so that Power BI can use this token to access your API.
https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-configure-app-access-web-apisIn your custom connector, configure OAuth2 using:
authorization_uri = "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize" token_uri = "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token" scope = "api://<your-api-client-id>/.default"
This ensures Power BI requests a valid token from Azure AD and sends it automatically in the Authorization header.Reconnect to your API from Power BI Desktop, sign in using your Azure AD credentials, and try refreshing the data.
Hope this clears it up. Let us know if you have any doubts regarding this. We will be happy to help.Thank you for using the Microsoft Fabric Community Forum.
hey v-kpoloju-msft , i was able to make the connector work in my local, now i want to publish the connector so that it's available within my teams workspace. how can i do it? any recommendations?
Hi aykhandelwal,
Thank you for the follow-up question.
Glad to hear you got the connector working locally. To make the custom connector available for others in your team or workspace, you will need to certify or deploy it through your organization’s Power BI environment. If your goal is for all team members to use it within Power BI Service, the connector must be deployed as an organizational data connector via a gateway.
You can copy the .mez file (custom connector) to your On-premises data gateway’s custom connectors folder, enable it in the Power BI Service, and make sure “Allow user-defined connectors” is turned on in the gateway settings.
For a wider rollout, your admin can also certify and distribute the connector across the tenant through Power BI Desktop or Fabric integration. This ensures other users can easily connect without manually configuring credentials.
You can review the setup guidance in the following docs for step-by-step instructions:
1. https://learn.microsoft.com/en-gb/power-bi/connect-data/service-gateway-custom-connectors
2. https://learn.microsoft.com/en-gb/power-query/handling-authentication#custom-connectors
Thank you for using the Microsoft Fabric Community Forum.
- aykhandelwal9 months agoMicrosoft Employee
hey v-kpoloju-msft , can you elaborate more on what do you mean by "To make the custom connector available for others in your team or workspace, you will need to certify or deploy it through your organization’s Power BI environment." what does powerBI organizational environment mean here?
- v-kpoloju-msft9 months agoCommunity Support
Hi aykhandelwal,
Thank you for the follow-up question also, thanks for asking for clarification.When we refer to your organization’s Power BI environment, it simply means your Power BI tenant, which is the shared environment managed under your company’s Microsoft 365 or Azure Active Directory (AAD) domain. Any workspaces, datasets, or connectors published there become part of your organization’s environment accessible to users who belong to the same AAD tenant.
In this context, publishing or certifying the connector means making it discoverable and usable by others in your organization through approved channels (like the Power BI Service via a gateway).To proceed, you can ask your Power BI admin or Fabric admin to deploy your .mez file to the On-premises data gateway’s custom connectors folder. Once deployed, the connector can be shared securely within your workspace or across the organization.