cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RikSN
Frequent Visitor

Auto refresh Afas connectors in PowerBI

Hi,

 

I am struggling with the connection between AFAS online and PowerBI online.

 

On my desktop PowerBI report I have connected several AFAS connectors to the PowerBI Desktop via a Web-source --> Advanced --> URL (HTTPS://[afas key].rest.afas.online/profitrestservices/connectors/[name connector]+ Authorization parameter (filled in the unique base 64 AFAS token). After connecting and setting a parameter for the token, I got following link in the query editor:

=Json.Document(Web.Contents("HTTPS://[afas key].rest.afas.online/profitrestservices/connectors/[name connector]", [headers=[Authorization={Parameter for the base 64 token}]])).

 

Now, I have 5 different connectors connected to my PowerBI desktop, and they all load and work when I refresh the report manually. After creating a whole dashboard I published it to the workspace for sharing.

 

The problem is that in the PowerBI web environment the report is not able to refresh. When I want to refresh an error comes up: "The credentials provided for the Web source are invalid. (Source at [afas link above])". I find this weird because it is able to load into the desktop version, so why not in the online version? The goal is to create automated refreshes.

 

I think it has something to do with the authorization parameter but I have no clue...

 

Thanks a lot for the help!

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @RikSN,

Have you config power bi url on your data source side? If not, you can take a look at the following document to add them to whitelist to prevent if these request has been blocked:
Add Power BI URLs to your allow list 
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @RikSN,

It sounds like a common issue when you work with a web connector and anonymous authorization. I'd like to suggest you add operation parameters 'RelativePath' on your connector and split your URL to root path and 'relative path'.

let
    Source =
        Json.Document(
            Web.Contents(
                "HTTPS://[afas key].rest.afas.online",
                [
                    RelativePath = "/profitrestservices/connectors/[name connector]",
                    Headers = [
                        Authorization = "[Token]"
                    ]
                ]
            )
        )
in
    Source

Reference link:

Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code 

'Dataset refresh : successfull via PBI-Desktop, but erroneous after publish to PBI-Service 
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Dear @v-shex-msft ,

 

Unfortunately the error remains... Is there another way?

Thanks!

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.