<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating OneLake files through REST API calls fails in Fabric platform</title>
    <link>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/3290980#M341</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="538677" data-lia-user-login="HimanshuS-msft" class="lia-mention lia-mention-user"&gt;HimanshuS-msft&lt;/a&gt;&amp;nbsp;: 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!&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2023 12:42:39 GMT</pubDate>
    <dc:creator>duttasoumya</dc:creator>
    <dc:date>2023-06-19T12:42:39Z</dc:date>
    <item>
      <title>Creating OneLake files through REST API calls fails</title>
      <link>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/3285932#M312</link>
      <description>&lt;P&gt;I have been trying to use the OneLake documentation for REST APIs to create a file without success.&lt;/P&gt;&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-api#onelake-and-adls-gen2-parity" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-api#onelake-and-adls-gen2-parity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the detailed repro steps below,&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;REPRO STEPS&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Spin up a new CDX environment.&lt;/LI&gt;&lt;LI&gt;Create a new service principal to query the OneLake in Fabric&lt;UL&gt;&lt;LI&gt;Go to Azure portal and then to App Registrations. Click on New to create.&lt;/LI&gt;&lt;LI&gt;Make a note of the Client ID, Tenant ID and create a new Client secret.&lt;/LI&gt;&lt;LI&gt;Make the following further configuration &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Path&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Value/ action&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;bc2adls&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Authentication &amp;gt; Redirect URIs (Web)&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;A href="https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/" target="_blank" rel="noopener"&gt;https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Supported account types&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Accounts in this organizational directory only (Contoso only - Single tenant)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;API Permissions &amp;gt; Configured permissions&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Add the following permissions,&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Grant admin content.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Expose an API&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Add a Scope &lt;STRONG&gt;OneLakeItem.Create &lt;/STRONG&gt;with some text in the mandatory fields. Take a note of URL for this scope for use on the last step.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Create a new Azure security group called &lt;STRONG&gt;PowerBIAdmin&lt;/STRONG&gt; and added owner as the Global administrator and a member with &lt;STRONG&gt;bc2adls&lt;/STRONG&gt; service principal created above.&lt;/LI&gt;&lt;LI&gt;Now, setup Microsoft Fabric&lt;UL&gt;&lt;LI&gt;Go to &lt;A href="https://fabric.microsoft.com" target="_blank" rel="noopener"&gt;https://fabric.microsoft.com&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;Click on the gear icon on the top ribbon and select &lt;STRONG&gt;Admin portal&lt;/STRONG&gt;. Click on the menu for &lt;STRONG&gt;Tenant settings&lt;/STRONG&gt; on the left.&lt;/LI&gt;&lt;LI&gt;Enable Fabric&lt;UL&gt;&lt;LI&gt;Under &lt;STRONG&gt;Microsoft Fabric (Preview)&lt;/STRONG&gt;, uncheck “Accept Microsoft’s default selection”.&lt;/LI&gt;&lt;LI&gt;Click on Enabled and apply to The entire organization.&lt;/LI&gt;&lt;LI&gt;Click Apply.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Allow API access&lt;UL&gt;&lt;LI&gt;Under &lt;STRONG&gt;Developer settings&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Allow service principals to use Power BI APIs&lt;/STRONG&gt;,&lt;/LI&gt;&lt;LI&gt;set Enabled = true&lt;/LI&gt;&lt;LI&gt;Apply to: &lt;STRONG&gt;The entire organization&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Click Apply.&lt;/LI&gt;&lt;LI&gt;On the same page, under &lt;STRONG&gt;Admin API settings&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Allow service principals to use read-only admin APIs&lt;/STRONG&gt;,&lt;/LI&gt;&lt;LI&gt;Set Enabled = true&lt;/LI&gt;&lt;LI&gt;Apply to: Specific security groups, and add &lt;STRONG&gt;PowerBIAdmin&lt;/STRONG&gt; security group&lt;/LI&gt;&lt;LI&gt;Click Apply.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Close the Admin portal.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;[OPTIONAL- doing this does not change the outcome!] Under &lt;STRONG&gt;Azure Active Directory&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Roles and Administrator&lt;/STRONG&gt;, look for &lt;STRONG&gt;Power BI Administrator&lt;/STRONG&gt;. Assign &lt;STRONG&gt;bc2adls&lt;/STRONG&gt; service principal created above.&lt;/LI&gt;&lt;LI&gt;Setup the workspace in Fabric.&lt;UL&gt;&lt;LI&gt;Create a workspace called &lt;STRONG&gt;BusinessCentralData&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Click on &lt;STRONG&gt;Manage access&lt;/STRONG&gt; on the workspace and then click on &lt;STRONG&gt;Add people or groups&lt;/STRONG&gt;. Add these roles for the users / service principals / security groups,&lt;BR /&gt;&lt;img /&gt;&lt;/LI&gt;&lt;LI&gt;Create a new lakehouse in the workspace called &lt;STRONG&gt;SandboxEnvironment&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Verify that the URL for the Files folder in the lakehouse is &lt;A href="https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/" target="_blank" rel="noopener"&gt;https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Make API calls to create files in the lakehouse, based on &lt;A href="https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-api#onelake-and-adls-gen2-parity" target="_blank" rel="noopener"&gt;the OneLake documentation&lt;/A&gt;.&lt;UL&gt;&lt;LI&gt;Open a tool like &lt;A href="https://www.postman.com/" target="_blank" rel="noopener"&gt;Postman&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;Create a new request to create a file called abc.txt on the OneLake.&lt;UL&gt;&lt;LI&gt;Http method: PUT&lt;/LI&gt;&lt;LI&gt;URL: &lt;A href="https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/abc.txt?resource=file" target="_blank" rel="noopener"&gt;https://onelake.dfs.fabric.microsoft.com/BusinessCentralData/SandboxEnvironment.Lakehouse/Files/abc.txt?resource=file&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Body: some text&lt;/LI&gt;&lt;LI&gt;Authorization: OAuth 2.0 with the tokens granted as per,&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;The values are copied over from Step 2 above.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Click on &lt;STRONG&gt;Send&lt;/STRONG&gt; to send the request out.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EXPECTED: A new file called &lt;STRONG&gt;abc.txt&lt;/STRONG&gt; is created under the &lt;STRONG&gt;Files&lt;/STRONG&gt; folder of our &lt;STRONG&gt;SandboxEnvironment&lt;/STRONG&gt; lakehouse as per &lt;A href="https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-api#samples" target="_blank" rel="noopener"&gt;the official OneLake doc&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACTUAL: &lt;STRONG&gt;401 Unauthorized response&lt;/STRONG&gt;: Authentication Failed with Audience validation failed for audience '00000002-0000-0000-c000-000000000000'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 12:45:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/3285932#M312</guid>
      <dc:creator>duttasoumya</dc:creator>
      <dc:date>2023-06-15T12:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating OneLake files through REST API calls fails</title>
      <link>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/3290980#M341</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="538677" data-lia-user-login="HimanshuS-msft" class="lia-mention lia-mention-user"&gt;HimanshuS-msft&lt;/a&gt;&amp;nbsp;: 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!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 12:42:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/3290980#M341</guid>
      <dc:creator>duttasoumya</dc:creator>
      <dc:date>2023-06-19T12:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating OneLake files through REST API calls fails</title>
      <link>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/4092730#M8988</link>
      <description>&lt;P&gt;I believe the Sas token is needed as well ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 23:59:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Fabric-platform/Creating-OneLake-files-through-REST-API-calls-fails/m-p/4092730#M8988</guid>
      <dc:creator>SyedN</dc:creator>
      <dc:date>2024-08-09T23:59:40Z</dc:date>
    </item>
  </channel>
</rss>

