<?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 Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1775584#M28861</link>
    <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/254842"&gt;@RayGn2000&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Where are you host the WCF service? Did these host on the same device that you tested the console application? Please share more detailed information to help us clarify your scenario:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_self"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In addition, please also take a look at the following link about power bi service URLs if you do not configure them on your server white list:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/power-bi-allow-list-urls" target="_blank"&gt;Add Power BI URLs to allow list - Power BI | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Apr 2021 01:29:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-04-09T01:29:13Z</dc:date>
    <item>
      <title>Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Request.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1764968#M28847</link>
      <description>&lt;P&gt;I am trying to refresh PBI dataset programmatically and to do so I am trying to get oath beaer token using the code below. The code works fine with a console app. But when I embed the code into a WCF web service and deploy in a web app then it throws&amp;nbsp;400) Bad Request error. The reason I had to pass user id and password because the WCF web service will run in backend anf will not have any GUI interaction for user authentication.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;resource -&amp;gt;&amp;nbsp;&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;&lt;/P&gt;&lt;P&gt;authority -&amp;gt;&amp;nbsp;&lt;A href="https://login.microsoftonline.com/*****tenant" target="_blank"&gt;https://login.microsoftonline.com/*****tenant&lt;/A&gt;&amp;nbsp;Id****/oauth2/token&lt;/P&gt;&lt;P&gt;cleint id and&amp;nbsp;ApplicationSecret has been collected from PBI app registration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;StringBuilder body = new StringBuilder();
            body.Append("resource=" + HttpUtility.UrlEncode(resourceUri));
            body.Append("&amp;amp;client_id=" + HttpUtility.UrlEncode(ApplicationID));
            body.Append("&amp;amp;grant_type=" + HttpUtility.UrlEncode("password"));
            body.Append("&amp;amp;username=" + HttpUtility.UrlEncode(userid));
            body.Append("&amp;amp;password=" + HttpUtility.UrlEncode(password));
            body.Append("&amp;amp;client_secret=" + HttpUtility.UrlEncode(ApplicationSecret));
            
            using (WebClient web = new WebClient())
            {                
                web.Headers.Add("Content-Type", "application/x-www-form-urlencoded");               
                string data = web.UploadString(authority, body.ToString()); // this line throws error
                dynamic result = JsonConvert.DeserializeObject(data);
                try
                {
                    return result.access_token;
                }
                catch
                {

                }
                return null;
            }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 03:28:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1764968#M28847</guid>
      <dc:creator>RayGn2000</dc:creator>
      <dc:date>2021-04-06T03:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1775584#M28861</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/254842"&gt;@RayGn2000&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Where are you host the WCF service? Did these host on the same device that you tested the console application? Please share more detailed information to help us clarify your scenario:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_self"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;In addition, please also take a look at the following link about power bi service URLs if you do not configure them on your server white list:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/power-bi-allow-list-urls" target="_blank"&gt;Add Power BI URLs to allow list - Power BI | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 01:29:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1775584#M28861</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-09T01:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1775589#M28863</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Xiaoxin&amp;nbsp; -&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have hosted the WCF service in an Azure web app. The console application works fine in my local computer (VS2019) and I always get a true oauth2 token.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I&amp;nbsp; access the WCF web service (using web app URL) it throws 400 bad request error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 01:41:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1775589#M28863</guid>
      <dc:creator>RayGn2000</dc:creator>
      <dc:date>2021-04-09T01:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1781882#M28945</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/254842"&gt;@RayGn2000&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Have you checked the setting of the azure web app configuration to confirm if power bi URLs are in the allow list?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions" target="_blank"&gt;Azure App Service access restrictions - Azure App Service | Microsoft Docs&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;BTW, you can also contact azure support to confirm if they have limits on the rest API usage when you host on the azure side.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 07:50:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1781882#M28945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-13T07:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1789415#M29040</link>
      <description>&lt;P&gt;Seems the URLs are allowed in the web app.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 13:38:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1789415#M29040</guid>
      <dc:creator>RayGn2000</dc:creator>
      <dc:date>2021-04-16T13:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Bearer token REST API throws  error The remote server returned an error: (400) Bad Requ</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1797178#M29107</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/254842"&gt;@RayGn2000&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Did this issue appear when you deploy the code to other web services? I'd like to confirm if these requests have been blocked by security or other azure settings.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 09:07:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Bearer-token-REST-API-throws-error-The-remote-server/m-p/1797178#M29107</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-21T09:07:56Z</dc:date>
    </item>
  </channel>
</rss>

