<?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: load arcgis online data into Power BI using OAuth2 in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1085577#M41557</link>
    <description>&lt;P&gt;so short of it is something like this. create a new blank query and dump in below. you need to create a client ID and secret first for your account.&lt;/P&gt;&lt;P&gt;there's a long thread somewhere on this i'll try and dig it up&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;//Custom Variables&lt;BR /&gt;client_id = "xxxx",&lt;BR /&gt;client_secret = "xxxx",&lt;BR /&gt;fsURL = &lt;A href="https://services5.arcgis.com/12345678990/ArcGIS/rest/services/ServiceName/FeatureServer/0/" target="_blank"&gt;https://services5.arcgis.com/12345678990/ArcGIS/rest/services/ServiceName/FeatureServer/0/&lt;/A&gt;,&lt;BR /&gt;whereClause = "objectid&amp;gt;0",&lt;BR /&gt;fieldsOut = "*",&lt;BR /&gt;tokenrequest = &lt;A href="https://www.arcgis.com/sharing/rest/oauth2/token/?client_id=&amp;amp;" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token/?client_id=&amp;amp;&lt;/A&gt; client_id &amp;amp; "&amp;amp;client_secret="&amp;amp; client_secret &amp;amp; "&amp;amp;grant_type=client_credentials",&lt;BR /&gt;&lt;BR /&gt;//Get Data&lt;BR /&gt;&lt;BR /&gt;Token_auto = Json.Document(Web.Contents(tokenrequest), 65001),&lt;BR /&gt;#"TokenTable" = Record.ToTable(Token_auto),&lt;BR /&gt;token = TokenTable{0}[Value],&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents(fsURL &amp;amp; "query?where=" &amp;amp; whereClause &amp;amp; "&amp;amp;outFields=" &amp;amp; fieldsOut &amp;amp; "&amp;amp;returnGeometry=false&amp;amp;f=pjson&amp;amp;token=" &amp;amp; token), 65001),&lt;BR /&gt;#"Converted to Table" = Record.ToTable(Source),&lt;BR /&gt;Value = #"Converted to Table"{7}[Value],&lt;BR /&gt;#"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),&lt;BR /&gt;#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"attributes"}, {"attributes"}),&lt;BR /&gt;#"Expanded attributes" = Table.ExpandRecordColumn(#"Expanded Column1", "attributes", {"OBJECTID", "Trace_Catchment_Name", "GlobalID", "Site", "Type", "Shape__Area", "Shape__Length", "Population"}, {"OBJECTID", "Trace_Catchment_Name", "GlobalID", "Site", "Type", "Shape__Area", "Shape__Length", "Population"})&lt;BR /&gt;in&lt;BR /&gt;#"Expanded attributes"&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 03:47:13 GMT</pubDate>
    <dc:creator>ZoltanKelly</dc:creator>
    <dc:date>2021-08-04T03:47:13Z</dc:date>
    <item>
      <title>load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1082526#M41383</link>
      <description>&lt;P&gt;Hi, I am trying to load a table feature into Power BI for some statistics (like daily/monthly total, or by day of week etc.). I created an OAuth2 APP. My intention is to try web query in PowerBI using the Authorise and Token API, but not sure how. Wondering anyone has done this successfully?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Song&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 11:57:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1082526#M41383</guid>
      <dc:creator>Song_Li</dc:creator>
      <dc:date>2021-07-25T11:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1085577#M41557</link>
      <description>&lt;P&gt;so short of it is something like this. create a new blank query and dump in below. you need to create a client ID and secret first for your account.&lt;/P&gt;&lt;P&gt;there's a long thread somewhere on this i'll try and dig it up&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;//Custom Variables&lt;BR /&gt;client_id = "xxxx",&lt;BR /&gt;client_secret = "xxxx",&lt;BR /&gt;fsURL = &lt;A href="https://services5.arcgis.com/12345678990/ArcGIS/rest/services/ServiceName/FeatureServer/0/" target="_blank"&gt;https://services5.arcgis.com/12345678990/ArcGIS/rest/services/ServiceName/FeatureServer/0/&lt;/A&gt;,&lt;BR /&gt;whereClause = "objectid&amp;gt;0",&lt;BR /&gt;fieldsOut = "*",&lt;BR /&gt;tokenrequest = &lt;A href="https://www.arcgis.com/sharing/rest/oauth2/token/?client_id=&amp;amp;" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token/?client_id=&amp;amp;&lt;/A&gt; client_id &amp;amp; "&amp;amp;client_secret="&amp;amp; client_secret &amp;amp; "&amp;amp;grant_type=client_credentials",&lt;BR /&gt;&lt;BR /&gt;//Get Data&lt;BR /&gt;&lt;BR /&gt;Token_auto = Json.Document(Web.Contents(tokenrequest), 65001),&lt;BR /&gt;#"TokenTable" = Record.ToTable(Token_auto),&lt;BR /&gt;token = TokenTable{0}[Value],&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents(fsURL &amp;amp; "query?where=" &amp;amp; whereClause &amp;amp; "&amp;amp;outFields=" &amp;amp; fieldsOut &amp;amp; "&amp;amp;returnGeometry=false&amp;amp;f=pjson&amp;amp;token=" &amp;amp; token), 65001),&lt;BR /&gt;#"Converted to Table" = Record.ToTable(Source),&lt;BR /&gt;Value = #"Converted to Table"{7}[Value],&lt;BR /&gt;#"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),&lt;BR /&gt;#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"attributes"}, {"attributes"}),&lt;BR /&gt;#"Expanded attributes" = Table.ExpandRecordColumn(#"Expanded Column1", "attributes", {"OBJECTID", "Trace_Catchment_Name", "GlobalID", "Site", "Type", "Shape__Area", "Shape__Length", "Population"}, {"OBJECTID", "Trace_Catchment_Name", "GlobalID", "Site", "Type", "Shape__Area", "Shape__Length", "Population"})&lt;BR /&gt;in&lt;BR /&gt;#"Expanded attributes"&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 03:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1085577#M41557</guid>
      <dc:creator>ZoltanKelly</dc:creator>
      <dc:date>2021-08-04T03:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1089446#M41756</link>
      <description>&lt;P&gt;Thanks, Zoltan. finally got time to test this and it works. there are two things users need to pay attention to:&lt;/P&gt;&lt;P&gt;1. to use this method, the privacy setting at PowerBI has to be "ignore all";&lt;/P&gt;&lt;P&gt;2. From above you can image, this is not a very secure method by sharing the credential;&lt;/P&gt;&lt;P&gt;If anyone knows a more secure way (allowing user to login with their credential), please let me know, many thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Song&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 21:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1089446#M41756</guid>
      <dc:creator>Song_Li</dc:creator>
      <dc:date>2021-08-16T21:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1099654#M42222</link>
      <description>&lt;P&gt;Hi, found that other thread - see here. this has all the details and is then how I cribbed down to above. it's regarding Excel, but any MS app using power query is applicable (Excel/PowerBI/whatever).&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/using-excel-to-access-arcgis-online-automated/td-p/486804" target="_blank"&gt;Using Excel to access Arcgis online (automated) - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 01:30:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1099654#M42222</guid>
      <dc:creator>ZoltanKelly</dc:creator>
      <dc:date>2021-09-19T01:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1099741#M42224</link>
      <description>&lt;P&gt;Thank you Zoltan Kelly, as I mention above that I get it working. The only issue is that I build this PowerBI project and I want to share the project with my colleague without sharing the secret. Is it possible to actually let them use their own login for 2 factor authentication to get access to the data within Power BI? Cheers, Song&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 02:33:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1099741#M42224</guid>
      <dc:creator>Song_Li</dc:creator>
      <dc:date>2021-09-20T02:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1245790#M49646</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/461248"&gt;@Song_Li&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/45133"&gt;@ZoltanKelly&lt;/a&gt;&amp;nbsp; - how did you get Power BI to recognize the token at the end of the url? When I look at the token table it has generated, but I am still getting an error that credentials are required.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AW_Grove_0-1672948382184.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59821iFC9E5A369DCA3C77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AW_Grove_0-1672948382184.png" alt="AW_Grove_0-1672948382184.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AW_Grove_1-1672948443245.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59822iB337DB8713F3C12E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AW_Grove_1-1672948443245.png" alt="AW_Grove_1-1672948443245.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 19:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1245790#M49646</guid>
      <dc:creator>AW_Grove</dc:creator>
      <dc:date>2023-01-05T19:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1249811#M49882</link>
      <description>&lt;P&gt;Thanks for this&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/45133"&gt;@ZoltanKelly&lt;/a&gt;,&amp;nbsp;works well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a quick note, I don't know if it's changed, or it's because I'm targeting enterprise instead of AGOL, but the features were index 1.&amp;nbsp;&lt;BR /&gt;Also, if you extract the fields (index 2 for me) you can extract the field names with List.Accumulate and pass these to&amp;nbsp;&lt;SPAN&gt;ExpandRecordColumn to avoid having to hardcode the field names.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    source = Json.Document(Web.Contents(queryURL), 65001),
    
    //Process Data 
    LayerDataTable = Record.ToTable(source),
    features = LayerDataTable{1}[Value],
    fields = LayerDataTable{2}[Value],
    fieldNames = List.Accumulate( fields, {}, (s,c)=&amp;gt; List.Combine({ s, {Record.Field(c,"name")} }) ),
    featuresTable = Table.FromList(features, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    expandedColumn = Table.ExpandRecordColumn(featuresTable, "Column1", {"attributes"}, {"attributes"}),
    expandedAttributes = Table.ExpandRecordColumn(expandedColumn, "attributes", fieldNames)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 06:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1249811#M49882</guid>
      <dc:creator>TaylorCarnell1</dc:creator>
      <dc:date>2023-01-20T06:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1255059#M50135</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412059"&gt;@TaylorCarnell1&lt;/a&gt;&amp;nbsp;, would you be able to provide the url you are using for accessing Enterprise?&amp;nbsp; I am using ArcGIS Enterprise too and I cant seem to nail what the URL for requesting the token is.&amp;nbsp; I have an app I set up in the portal.&lt;/P&gt;&lt;P&gt;If I use this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;tokenrequest = "https://gisportal.&amp;lt;MY DOMAIN&amp;gt;/portal/sharing/rest/generateToken/?client_id=" &amp;amp; client_id &amp;amp; "&amp;amp;client_secret=" &amp;amp; client_secret &amp;amp; "&amp;amp;grant_type=client_credentials",&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error:&lt;/P&gt;&lt;P&gt;"DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server."&lt;/P&gt;&lt;P&gt;If I use this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;tokenrequest = "https://gisportal.&amp;lt;MY DOMAIN&amp;gt;/portal/sharing/rest/oauth/token/?client_id=" &amp;amp; client_id &amp;amp; "&amp;amp;client_secret=" &amp;amp; client_secret &amp;amp; "&amp;amp;grant_type=client_credentials",&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get "(400): Bad Request"&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 22:15:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1255059#M50135</guid>
      <dc:creator>AshParker1</dc:creator>
      <dc:date>2023-02-03T22:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1255264#M50141</link>
      <description>&lt;P&gt;The second one, but ../oauth2/..&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 10:01:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1255264#M50141</guid>
      <dc:creator>TaylorCarnell1</dc:creator>
      <dc:date>2023-02-06T10:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: load arcgis online data into Power BI using OAuth2</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1364167#M56519</link>
      <description>&lt;P&gt;Hi, I followed the steps and it works very well.&lt;/P&gt;&lt;P&gt;Now I want to publish the power bi dashboard once the map is loaded, but it is asking for ArcGis account credentials to the end user...&lt;/P&gt;&lt;P&gt;How can I solve this? The end users (multiple) are not part of my organisation, they will just visualize the map and not do any modification. How can I share it?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2023 15:26:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/load-arcgis-online-data-into-power-bi-using-oauth2/m-p/1364167#M56519</guid>
      <dc:creator>NasreddineD</dc:creator>
      <dc:date>2023-12-23T15:26:53Z</dc:date>
    </item>
  </channel>
</rss>

