Forum Discussion

RichOB's avatar
RichOB
Icon for Post Partisan rankPost Partisan
11 months ago
Solved

Dynamics > PowerBi DataSouce error (404) default company cannot be found

I am using a Web Services query in Dynamics, then pulling the data into PowerBi using the oData process. I can refresh the data in the desktop dashboard fine, but when I want to schedule an automated...
  • tayloramy's avatar
    11 months ago

    Hi RichOB

     

    That error means the refresh account in the Power BI Service is hitting Business Central without a “default company,” so BC returns 404. Desktop works because your user likely has a default company set, but the cloud refresh identity does not.

    Quick solution

    1. Put the company in the URL (don’t rely on “default”).
      OData v4 web services:
      https://api.businesscentral.dynamics.com/v2.0/<tenant>/<environment>/ODataV4/Company('Your%20Company%20Name')/<WebServiceName>
      Notes: URL-encode spaces/commas, and if the name contains a single quote, escape it as two single quotes. Docs: Publish a Web Service.
      Or switch to the Web API (recommended) and use company ID:
      https://api.businesscentral.dynamics.com/v2.0/<tenant>/<environment>/api/v2.0/companies(<companyId>)/...
      Get companyId from GET /api/v2.0/companies. Docs: GET companies.
    2. Update dataset credentials in the Service (Settings > Datasets > Data source credentials). Use OAuth2 and sign in with a BC user that has access to that company. If you’re using an app/service principal, it must be granted access and you still need to include the company in the URL. Docs: Service-to-service authentication, and Power BI refresh notes: Refresh troubleshooting.
    3. Test the company list if you’re unsure of the exact name/ID:
      OData v4: hit .../ODataV4/Company to see available companies.
      Web API: hit .../api/v2.0/companies.
      (The “default company cannot be found” guidance to add company=[name] or include Company in the path is a known fix discussed here: community thread with the exact error, plus MS docs above.)

     

    If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.