Forum Discussion

RaulSantos's avatar
RaulSantos
Regular Visitor
1 year ago
Solved

Use API to execute query to dataset giving Unauthorized Error

Hello,   I am having troubles trying to execute the following endpoint: https://api.powerbi.com/v1.0/myorg/datasets/{dataset_id}/executeQueries Body: {   "queries": [     {       "query": "E...
  • v-venuppu's avatar
    1 year ago

    Hi RaulSantos ,

    Thank you for reaching out to Microsoft Fabric Community.

    The 401 Unauthorized error likely means the Service Principal lacks access to the specific dataset, even if it works for others in the same workspace. Make sure the SPN has Build or Read permissions directly on the dataset (via Dataset > Settings > Permissions). Also, confirm that Service Principal access is enabled in the Power BI Admin Portal and the SPN is in the allowed security group. Older datasets may have hidden ownership issues - deleting and republishing resets ownership, which is why that workaround helped. Reassigning access or publishing from the SPN should resolve it.

    Thank you.