<?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: Power Bi REST API - Groups - 401 in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/423404#M12712</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/65419"&gt;@ES_CW&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Did you click the "Grant permissions" after select the permission items?&lt;/P&gt;&lt;A href="https://ibb.co/kRyOmT" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/cfe86c57e0f82089fcede79c50a5eb351b194c56/68747470733a2f2f696d6167652e6962622e636f2f6e36487574382f506f7765725f42695f524553545f4150495f47726f7570735f3430312e706e67" alt="Power_Bi_REST_API_Groups_401" border="0" /&gt;&lt;/A&gt;
&lt;P&gt;2. Did you have a step that would retrieve the token before this step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Dale&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2018 07:50:34 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2018-05-23T07:50:34Z</dc:date>
    <item>
      <title>Power Bi REST API - Groups - 401</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/422119#M12650</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on troubleshooting an issue in the power BI service and am pretty stuck. &amp;nbsp;With a .NET console app, I am able to&amp;nbsp;create and get a dataset as well as add rows to a table in the dataset. &amp;nbsp;I cannot do an HTTP GET to&amp;nbsp;"&lt;A href="https://api.PowerBI.com/v1.0/myorg/groups" target="_blank"&gt;https://api.PowerBI.com/v1.0/myorg/groups&lt;/A&gt;" without getting a 401 using the same creds to do the work around the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Relevant details:&lt;/P&gt;&lt;P&gt;1) This is a native app&lt;/P&gt;&lt;P&gt;2) &amp;nbsp;I have tried both the auth token for the app and also using the user context&lt;/P&gt;&lt;P&gt;3) &amp;nbsp;I am the owner of the app in Azure AD and have admin access to the Power BI site for our org&lt;/P&gt;&lt;P&gt;4) &amp;nbsp;All permissions have been set for power&amp;nbsp;bi and 3 for AAD:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="permissions.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/97141i83F066ED8ABBE24E/image-size/large?v=v2&amp;amp;px=999" role="button" title="permissions.PNG" alt="permissions.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;        {
            string powerBIGroups = "https://api.PowerBI.com/v1.0/myorg/groups";
            HttpWebRequest request = System.Net.WebRequest.Create(powerBIGroups) as System.Net.HttpWebRequest;
            request.KeepAlive = true;
            request.Method = "GET";

            //Add token to the request header
            request.Headers.Add("Authorization", String.Format("Bearer {0}", token));

            string datasetId = string.Empty;
            //Get HttpWebResponse from GET request
            using (HttpWebResponse httpResponse = request.GetResponse() as System.Net.HttpWebResponse)
            {
                //Get StreamReader that holds the response stream
                using (StreamReader reader = new System.IO.StreamReader(httpResponse.GetResponseStream()))
                {
                    string responseContent = reader.ReadToEnd();

                    var results = JsonConvert.DeserializeObject&amp;lt;dynamic&amp;gt;(responseContent);

                    //Get the first id
                    datasetId = results["value"][0]["id"];

                    Console.WriteLine(String.Format("Dataset ID: {0}", datasetId));
                    Console.ReadLine();

                    return datasetId;
                }
            }

        }&lt;/PRE&gt;&lt;P&gt;The error is thrown at "using (HttpWebResponse httpResponse = request.GetResponse() as System.Net.HttpWebResponse)":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An unhandled exception of type 'System.Net.WebException' occurred in System.dll&lt;BR /&gt;Additional information: The remote server returned an error: (401) Unauthorized. occurred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas? &amp;nbsp;I would like to get the dataset into a group so I can share with others in the org.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 20:40:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/422119#M12650</guid>
      <dc:creator>ES_CW</dc:creator>
      <dc:date>2018-05-21T20:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Power Bi REST API - Groups - 401</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/423404#M12712</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/65419"&gt;@ES_CW&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Did you click the "Grant permissions" after select the permission items?&lt;/P&gt;&lt;A href="https://ibb.co/kRyOmT" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/cfe86c57e0f82089fcede79c50a5eb351b194c56/68747470733a2f2f696d6167652e6962622e636f2f6e36487574382f506f7765725f42695f524553545f4150495f47726f7570735f3430312e706e67" alt="Power_Bi_REST_API_Groups_401" border="0" /&gt;&lt;/A&gt;
&lt;P&gt;2. Did you have a step that would retrieve the token before this step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Dale&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 07:50:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/423404#M12712</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-05-23T07:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Power Bi REST API - Groups - 401</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/425601#M12839</link>
      <description>&lt;P&gt;Thanks Dale. &amp;nbsp;I had thought I had the access, as it shows all access granted, but I am not an admin for the Azure AD instance, and as it turns out, even though I didn't have access granted, it showed that I did. &amp;nbsp;That was my downfall.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So - your fix above worked. &amp;nbsp;I just had a false positive in the dashboard, and I made the assumption that it was granted. &amp;nbsp;At any rate, it is now. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:33:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-Bi-REST-API-Groups-401/m-p/425601#M12839</guid>
      <dc:creator>ES_CW</dc:creator>
      <dc:date>2018-05-25T14:33:12Z</dc:date>
    </item>
  </channel>
</rss>

