Forum Discussion

hsa297's avatar
hsa297
New Member
10 months ago
Solved

Creating connection to Warehouse

I am trying to create a connection to a Warehouse artifact in Fabric, below is the setup I am doing but I am facing an issue with connection. I am getting the following error when creating. Below is ...
  • v-dineshya's avatar
    10 months ago

    Hi hsa297 ,

    Thank you for reaching out to the Microsoft Community Forum.

     

    Please check below things to fix the "401" Error.


    1. Please check the Tenant ID, Service Principal ID, and Service Principal Key for typos or outdated values. Check the key hasn’t expired.

     

    2. Please confirm the Service Principal has Fabric Admin or Warehouse Contributor roles assigned. Check if the Service Principal is granted API permissions for Microsoft Fabric.

     

    3. You mentioned that enabling Service Principal settings, Check that “Users can consent to apps accessing company data on their behalf” is enabled. The app registration is multi-tenant if you are accessing resources across tenants.


    4. Check the Service Principal is added as a user to the Warehouse artifact with appropriate permissions. You can check this via SQL commands.

     

    SQLCREATE USER [appId] FROM EXTERNAL PROVIDER;
    ALTER ROLE db_datareader ADD MEMBER [appId];
    ALTER ROLE db_datawriter ADD MEMBER [appId];


    5. If you are using VNet or on-prem gateways, check the gateway is properly configured and reachable. Try to disable the gateway option temporarily to test direct connectivity.

     

    6. A "401" often means the token wasn’t accepted. Use tools like Postman or Azure CLI to manually acquire a token using the Service Principal and test access.

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh