<?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 403 Forbidden error when creating Dataset using REST API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61326#M1960</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have an ASP.NET web app that would push&amp;nbsp;data to a PowerBI real-time dashboard. Following the steps of "&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-walkthrough-push-data/" target="_self"&gt;Push data into dashboard&lt;/A&gt;", I registered my web-app and got a client id and secret.&lt;/P&gt;&lt;P&gt;The following code gets me the token:&lt;/P&gt;&lt;PRE&gt;AuthenticationContext authContext = new AuthenticationContext(authorityUri);
ClientCredential cc = new ClientCredential(clientID, clientSecret);
Task&amp;lt;AuthenticationResult&amp;gt; task = authContext.AcquireTokenAsync(resourceUri, cc);
AuthenticationResult ar = task.Result;&lt;BR /&gt;string token = ar.AccessToken;&lt;/PRE&gt;&lt;P&gt;I use this since I do not want an interactive logon. The web-app will just keep pushing data to the dashboard every time it has something new. The token is successfully received and is then used to&amp;nbsp;create a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The server responds with a 403 Forbidden error message. The only reason that comes to my mind is that it might be because I have two Active Directories. My web-app is in AAD 1 (the corporate AAD) while the&amp;nbsp;&lt;SPAN&gt;dev.powerbi.com/apps page registers the application to AAD 2.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I unfortunately do not have access to add applications to AAD1 and hence must wait for the admin to respond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question: Have I correctly identified the root cause of the problem or is it something else that I might have completely left out?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2016 12:22:42 GMT</pubDate>
    <dc:creator>syedaliammar</dc:creator>
    <dc:date>2016-08-23T12:22:42Z</dc:date>
    <item>
      <title>403 Forbidden error when creating Dataset using REST API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61326#M1960</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have an ASP.NET web app that would push&amp;nbsp;data to a PowerBI real-time dashboard. Following the steps of "&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-walkthrough-push-data/" target="_self"&gt;Push data into dashboard&lt;/A&gt;", I registered my web-app and got a client id and secret.&lt;/P&gt;&lt;P&gt;The following code gets me the token:&lt;/P&gt;&lt;PRE&gt;AuthenticationContext authContext = new AuthenticationContext(authorityUri);
ClientCredential cc = new ClientCredential(clientID, clientSecret);
Task&amp;lt;AuthenticationResult&amp;gt; task = authContext.AcquireTokenAsync(resourceUri, cc);
AuthenticationResult ar = task.Result;&lt;BR /&gt;string token = ar.AccessToken;&lt;/PRE&gt;&lt;P&gt;I use this since I do not want an interactive logon. The web-app will just keep pushing data to the dashboard every time it has something new. The token is successfully received and is then used to&amp;nbsp;create a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The server responds with a 403 Forbidden error message. The only reason that comes to my mind is that it might be because I have two Active Directories. My web-app is in AAD 1 (the corporate AAD) while the&amp;nbsp;&lt;SPAN&gt;dev.powerbi.com/apps page registers the application to AAD 2.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I unfortunately do not have access to add applications to AAD1 and hence must wait for the admin to respond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question: Have I correctly identified the root cause of the problem or is it something else that I might have completely left out?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 12:22:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61326#M1960</guid>
      <dc:creator>syedaliammar</dc:creator>
      <dc:date>2016-08-23T12:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: 403 Forbidden error when creating Dataset using REST API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61685#M1967</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3473"&gt;@syedaliammar&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3473"&gt;@syedaliammar&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have an ASP.NET web app that would push&amp;nbsp;data to a PowerBI real-time dashboard. Following the steps of "&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-walkthrough-push-data/" target="_self"&gt;Push data into dashboard&lt;/A&gt;",&lt;STRONG&gt; I registered my web-app&lt;/STRONG&gt; and got a client id and secret.&lt;/P&gt;&lt;P&gt;The following code gets me the token:&lt;/P&gt;&lt;PRE&gt;AuthenticationContext authContext = new AuthenticationContext(authorityUri);
ClientCredential cc = new ClientCredential(clientID, clientSecret);
Task&amp;lt;AuthenticationResult&amp;gt; task = authContext.AcquireTokenAsync(resourceUri, cc);
AuthenticationResult ar = task.Result;&lt;BR /&gt;string token = ar.AccessToken;&lt;/PRE&gt;&lt;P&gt;I use this since I do not want an interactive logon. The web-app will just keep pushing data to the dashboard every time it has something new. The token is successfully received and is then used to&amp;nbsp;create a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The server responds with a 403 Forbidden error message. The only reason that comes to my mind is that it might be because I have two Active Directories. &lt;STRONG&gt;My web-app is in AAD 1&lt;/STRONG&gt; (the corporate AAD) while &lt;STRONG&gt;the&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;dev.powerbi.com/apps page registers the application to AAD 2&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I unfortunately do not have access to add applications to AAD1 and hence must wait for the admin to respond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question: Have I correctly identified the root cause of the problem or is it something else that I might have completely left out?&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3473"&gt;@syedaliammar&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got confused by the bold part, isn't the web-app regisitered&amp;nbsp; on the dev.powerbi.com/apps? if the same thing, how come two AAD invloved in this case?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 09:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61685#M1967</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2016-08-24T09:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: 403 Forbidden error when creating Dataset using REST API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61849#M1975</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang﻿&lt;/a&gt;&amp;nbsp;Honestly,&amp;nbsp;I am also a bit confused here. Let me try to&amp;nbsp;provide you further details that might help you identify the problem.&lt;/P&gt;&lt;P&gt;I have a corporate Azure account (ending with "...onmicrosoft.com") that I use for PowerBI as well as the Azure Portal. The portal shows me two directories when I login, AD1 and AD2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All work is done in the company's globally managed Azure AD1 and this is where the web-app also exists. Following the steps, I then added this web-app to the Azure AD by going to &lt;A href="https://dev.powerbi.com/apps" target="_blank"&gt;https://dev.powerbi.com/apps&lt;/A&gt;, logging in with my onmicrosoft.com account, filling the details in and clicking on the "Register App" button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this registers the web-app in AD2. My concerns here:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Is it because AD1 is managed by global admins and I don't have permissions to add apps to it?&lt;/LI&gt;&lt;LI&gt;I can see it&amp;nbsp;listed in the list of applications under AD2. How did it choose AD2 and not AD1 when I clicked the Register App button?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Moving on, I attempted to create the dataset using the &lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-walkthrough-push-data-create-dataset/" target="_self"&gt;snippet provided here&lt;/A&gt;&amp;nbsp;with&amp;nbsp;the token received and failed by getting the &lt;STRONG&gt;403 Forbidden&lt;/STRONG&gt; error response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I &lt;A href="http://docs.powerbi.apiary.io/#reference/datasets/datasets-collection/create-a-dataset" target="_self"&gt;Create a dataset using Apiary&lt;/A&gt;, it is created without any problems which is again confusing to me. Do I need to &lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-authenticate-a-web-app/" target="_self"&gt;authenticate the web-app&lt;/A&gt; first and then use the following?&lt;/P&gt;&lt;PRE&gt;AuthenticationResult AR = AC.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), cc);&lt;/PRE&gt;&lt;P&gt;I'd really appreciate any help you could provide.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 15:26:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/403-Forbidden-error-when-creating-Dataset-using-REST-API/m-p/61849#M1975</guid>
      <dc:creator>syedaliammar</dc:creator>
      <dc:date>2016-08-24T15:26:37Z</dc:date>
    </item>
  </channel>
</rss>

