6

I have an .odc (office data connection) that connects Excel to a Web Service (MSBI, Web PowerBI).

It's working fine. I open the odc file, Excel opens up and it is connected to the data source.

How can I open this connection directly from R?

The odc file contents are:

 <odc:ConnectionString>
    Provider=MSOLAP;
    Integrated Security=ClaimsToken;
    Identity Provider=https://login.microsoftonline.com/common, 
    https://analysis.windows.net/powerbi/api, xxxxxx-xx-xx-xxxxxx;
    Data Source=pbiazure://api.powerbi.com;
    Initial Catalog=xxxxx-xxxx-xxxx-xxxx-xxxxx;
    MDX Compatibility= 1;
    MDX Missing Member Mode= Error;
    Safety Options= 2;
    Update Isolation Level= X;
    Locale Identifier= 10XX
    </odc:ConnectionString>

This is what I tried so far:

library(httr); library(httpuv)
oauth_endpoints("azure")
powerbi.urls <- oauth_endpoint(access    =  "authorize", 
                               authorize =  "token", 
                               base_url  =  "https://login.windows.net/common/oauth2")

powerbi.app <- oauth_app(
                         appname = "pbiazure://api.powerbi.com XXXX-XX-XXX-a611",
                         key     = "XXXXXXXXX",
                         secret  = "XXXXXXXXX")

powerbi.token <- oauth2.0_token(powerbi.urls, powerbi.app,
                                user_params = list(resource = "https://analysis.windows.net/powerbi/api"),
                                use_oob = FALSE)

But it is returning the following error:

AADSTS900561: The endpoint only accepts POST, OPTIONS requests. Received a GET request.

Dan
  • 1,711
  • 2
  • 24
  • 39
  • 1
    I'd like to learn more about ODC, I understand there is a difference, but have you looked into connecting to the ODC through the package `odbc` which handles Database connections? – Daniel_j_iii Jun 16 '20 at 16:08
  • Which expression is returning the error? You may need to run each line individually in order to figure it out. – AColeman Jun 17 '20 at 19:33
  • @Daniel Jachetta, I anticipate that yes, I'll need to use odbc to connect to it after I get this 'connecting to' web powerbi first step done – Dan Jun 18 '20 at 03:10

0 Answers0