Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
duttasoumya
Microsoft Employee
Microsoft Employee

Creating OneLake files through REST API calls fails

I have been trying to use the OneLake documentation for REST APIs to create a file without success.

Reference: https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-api#onelake-and-adls-gen2-parity

 

 

See the detailed repro steps below,

-----

REPRO STEPS

  1. Spin up a new CDX environment.
  2. Create a new service principal to query the OneLake in Fabric
    • Go to Azure portal and then to App Registrations. Click on New to create.
    • Make a note of the Client ID, Tenant ID and create a new Client secret.
    • Make the following further configuration

      Path

      Value/ action

      Name

      bc2adls

      Authentication > Redirect URIs (Web)

      https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/

      Supported account types

      Accounts in this organizational directory only (Contoso only - Single tenant)

      API Permissions > Configured permissions

      Add the following permissions,

      ApiPermissions.png

       

      Grant admin content.

      Expose an API

      Add a Scope OneLakeItem.Create with some text in the mandatory fields. Take a note of URL for this scope for use on the last step.

  3. Create a new Azure security group called PowerBIAdmin and added owner as the Global administrator and a member with bc2adls service principal created above.
  4. Now, setup Microsoft Fabric
    • Go to https://fabric.microsoft.com.
    • Click on the gear icon on the top ribbon and select Admin portal. Click on the menu for Tenant settings on the left.
    • Enable Fabric
      • Under Microsoft Fabric (Preview), uncheck “Accept Microsoft’s default selection”.
      • Click on Enabled and apply to The entire organization.
      • Click Apply.
    • Allow API access
      • Under Developer settings > Allow service principals to use Power BI APIs,
      • set Enabled = true
      • Apply to: The entire organization
      • Click Apply.
      • On the same page, under Admin API settings > Allow service principals to use read-only admin APIs,
      • Set Enabled = true
      • Apply to: Specific security groups, and add PowerBIAdmin security group
      • Click Apply.
    • Close the Admin portal.
  5. [OPTIONAL- doing this does not change the outcome!] Under Azure Active Directory > Roles and Administrator, look for Power BI Administrator. Assign bc2adls service principal created above.
  6. Setup the workspace in Fabric.
  7. Make API calls to create files in the lakehouse, based on the OneLake documentation.

 

EXPECTED: A new file called abc.txt is created under the Files folder of our SandboxEnvironment lakehouse as per the official OneLake doc.

 

ACTUAL: 401 Unauthorized response: Authentication Failed with Audience validation failed for audience '00000002-0000-0000-c000-000000000000'

 

2 REPLIES 2
SyedN
Regular Visitor

I believe the Sas token is needed as well ?

duttasoumya
Microsoft Employee
Microsoft Employee

@GeethaT-MSFT , @HimanshuS-msft : Could you kindly take a look at the above. Is there any step I am missing to make the REST API for Fabric work? Thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.