Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Not able to read Json file in Power BI Custom Connector

Hi,

I am building Power BI Custom connector which will be access My web rsoureces using HTTP call.

My web app authenticates the  user using Azure AD and other ID provider service.

 

I want connector to use oauth for any given ID provider.
So I am using JSON file to store the credentials to connect to ID providers authentication service on Client PC and when user uses my new Data custom connector it fetch the credentials from JSON file in decided path on my PC.

I am doing this in following way

 

 

powerBiClientID = Json.Document(File.Contents("C:\FBX\PowerBI\AuthData.json"))[ClientID];

 

 

 
And while sign in I am getting following error

nagendragillalu_0-1643854592945.png

 I am not able to get the root cause or how to deal with this exception.
Can any one please guide or help to resolve this.

With regards
Nagendra

Status: Investigating

Hi @Anonymous 

 

Did you get this issue by using your Custom Connector to connect to the data source in Power BI Desktop? To use the Custom Connector, To use a non-certified custom connector, you need put the connector .pq, .pqx, .m, or .mez file in the [Documents]\Power BI Desktop\Custom Connectors folder on the machines of users who are using this connector. If the folder doesn't exist, create it. After that, adjust the data extension security settings as follows:

In Power BI Desktop, select File > Options and settings > Options > Security. Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning. Select OK, and then restart Power BI Desktop.

vcazhengmsft_0-1643943904604.png

 

Since the credentials are stored in the JSON file, please make sure these users have permissions to read it and these credentials can be identified and parsed by the connector after reading from this JSON file.

 

If you do this test from Power BI service, then gateway is needed for your case. And additional configuration is needed. For more details, refer to Use custom data connectors with the on-premises data gateway - Power BI | Microsoft Docs.

 

Best Regards,

Community Support Team _ Caiyun

 

Comments
v-cazheng-msft
Community Support
Status changed to: Investigating

Hi @Anonymous 

 

Did you get this issue by using your Custom Connector to connect to the data source in Power BI Desktop? To use the Custom Connector, To use a non-certified custom connector, you need put the connector .pq, .pqx, .m, or .mez file in the [Documents]\Power BI Desktop\Custom Connectors folder on the machines of users who are using this connector. If the folder doesn't exist, create it. After that, adjust the data extension security settings as follows:

In Power BI Desktop, select File > Options and settings > Options > Security. Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning. Select OK, and then restart Power BI Desktop.

vcazhengmsft_0-1643943904604.png

 

Since the credentials are stored in the JSON file, please make sure these users have permissions to read it and these credentials can be identified and parsed by the connector after reading from this JSON file.

 

If you do this test from Power BI service, then gateway is needed for your case. And additional configuration is needed. For more details, refer to Use custom data connectors with the on-premises data gateway - Power BI | Microsoft Docs.

 

Best Regards,

Community Support Team _ Caiyun

 

Anonymous
Not applicable

HI @v-cazheng-msft 

I am getting this error when I am running the custom connector in Power BI desktop where I already had settings mentioned by you 

nagendragillalu_0-1643948899421.png

I am able to see connector in Power BI data sources

nagendragillalu_2-1643949208107.png

I get sign in UI

nagendragillalu_3-1643949281881.png

When I click on Sign in Button I get following error.

nagendragillalu_4-1643949346725.png

 

Oauth credentials are read from json file which i had stored in my local PC.

 

powerBiClientID = Json.Document(File.Contents("C:\FBX\PowerBI\AuthData.json"))[ClientID];
authorize_uri = Json.Document(File.Contents("C:\FBX\PowerBI\AuthData.json"))[AuthDomain];

 


I hope above details will be helpfull for your suggestions

Thank and regards
Nagendra