Here is a post that is long overdue as the functionality has been available for almost a year now. Today we will enable scheduled refresh to the Strava custom connector I build before.
The trick to this is that we need to extend the code of the Strava connector with a “TestConnection” function as is described here. This will allow the Power BI gateway to know how to test the connection.
Of course we will start with getting the latest code from the GitHub repo.
Now all we have to add is a method that will tell Power BI how to test the connection. In my case it was just adding this line of code so going from:
Strava = [
Authentication = [
OAuth = StartLogin = StartLogin, FinishLogin = FinishLogin, Label = Extension.LoadString("AuthenticationLabel")
],
Label = Extension.LoadString("DataSourceLabel")
];
To
Strava = [
TestConnection = (dataSourcePath) => { "Strava.Contents" },
Authentication = [
OAuth = StartLogin = StartLogin, FinishLogin = FinishLogin, Label = Extension.LoadString("AuthenticationLabel")
],
Label = Extension.LoadString("DataSourceLabel")
];
This adds a way for Power BI to know what function to use when testing a connection. This is needed for the Power BI to refresh the dataset. Power BI needs to know if it can refresh before you schedule it. This only works through the personal GW though as this is a custom connector that has not been verified. Let’s set that up. First we turn on Custom connectors in the GW. Then I take the MEZ file that I got as build output from Visual Studio solution and copy it to the Personal GW folder as specified in the GW setup.

As you can see it is now recognized by the gateway. Next we upload the Power BI desktop file to Power BI and set the credentials there:

Now I can set them:

Sign in will pop up the Strava sign in and will request for access.

Now the refresh starts running and we are good to go 🙂

This very small addition now enables your dashboards and reports to always be up to date automatically :). To play with it download the connector here on Github.
Hi Kasper,
Is it correct to say that you can only refresh a custom connector via on-prem gateway if the custom connector is verified?
Kr,
Valérie
That is not correct.
Hi Andre,
what is not correct? doesn’t it work for you?
Thanks,
Kasper
Hi,
Thanks for your Strava PowerBi guides. I have it wokring on the desktop but tried this extra link and I get a fail when trying to connect in the last authorisation stage. I get a message saying failed to update credentials. (Failed to update data source credentials)
Hello Kasper,
I followed the steps and it works allmost to the end of your blog (even the login in Strava works well). But the last step (scheduled refresh) is grey and I can’t fill in any).
Do you know what I am doing wrong?
Thanks,
Ype
Dear Kaspar,
Where do you set the AuthenticationLabel value? I’ve tried looking in my resources.resx file but can’t see it.
Many thanks,
Ed HP
Hi there,
Where do you set your “AuthenticationLabel” value? I’ve tried looking in my resources.resx file but it’s not in there.
Kind regards,
Ed
Hellos.
I’ve tried replicating your example, as well as the default Tripin example located here.
https://docs.microsoft.com/en-us/power-query/samples/trippin/9-testconnection/readme
After both attempts, I get the exact same error in the Datasets tab in PB Online.
‘Unable to determine the data source due to unknown functions. When custom connectors are used, the error can happen if gateway doesn’t have the extension enabled. Details: Query contains unknown function name: TripPin.Contents. (when using your connector, it would say ‘Strava.Contents’ here instaed of ‘TripPin.Contents’)
Data source for Query1′
I’ve posted the details with screenshots here.
https://github.com/MicrosoftDocs/powerquery-docs/issues/95
Do you perhaps know what I’m doing wrong?
Kind regards,
Thinus
Hi Thinus,
I had the same issue and found how to fix it:
1. Restart your Gateway
2. Make sure you have the correct path to the correct folder of the custom connector
3. Turn the custom connectors toggle off and turn it on again.
When I did this, the custom connector was found and it will display the name of the custom connector (in the gateway).
4. Go to PowerBI Service and find out if the message is gone. I was able to see the gateway connection now.