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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
richardc1
Helper I
Helper I

Avoiding free text credentials in Power BI query.

I have a Perfectly working query that extract data from Service now via the REST API integration.

 

()=>
let
clientid = "[clientid]",
clientsecret = "[shhh]",
un = "POWERBIACC",
pw = "[password]",
Token = "Bearer [blah blah blah]",

body = [grant_type="password", client_id=clientid, client_secret=clientsecret, username=un, password=pw, Authorization=Token],
Data=Json.Document(Web.Contents("https://Instance.service-now.com/oauth_token.do",[Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(Uri.BuildQueryString(body))])),
access_token = Data[access_token]
in
access_token

 

The issue is, my company won't accpet saved credentials in the PBIX.

Even removing them and saving once the file is published isn't acceptable, as "human's make mistakes"

 

It was suggested that prompring for the credenials when run would be acceptable, but I do not know if this is even possible.

 

Is there anyway to run this code without using saved free-text credentials?

 

2 ACCEPTED SOLUTIONS

Thanks for your reply.

 

"Get data from the source and don't load the data in the report, just use it to log in the API. That way you are not adding text at PowerBi. "

 

I am not sure how I would do this, how would Power BI 'know' I had authenticated?

View solution in original post

Let me write an example. If you create a table at excel sharepoint with the following columns: 

clientid | clientsecret | user | password

Get data from the excel file. Then you can get the string of each column to authenticate at the API. You are not writing text at the powerbi literally and you can get data from the API.

Once you have connected to the API and before close & apply, click on the excel and "don't load" the table. That way it won't be visible for the model.

I hope that make sense

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

4 REPLIES 4
ibarrau
Super User
Super User

Hi. If the problem is about inserting the password manually at PowerBi, you could just save the credentials in a file at sharepoint, file at blob storage or even a database. Get data from the source and don't load the data in the report, just use it to log in the API. That way you are not adding text at PowerBi. 

If you want to deep dive in the scenario, you could try a custom connector for connecting to Azure Key Vaults. That might require a little more experience like working with custom connectors and creating a Key Vault, you can check it here: https://www.bibb.pro/post/securing-your-api-power-bi-data-with-azure-key-vault#:~:text=Using%20Azure...

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Thanks for your reply.

 

"Get data from the source and don't load the data in the report, just use it to log in the API. That way you are not adding text at PowerBi. "

 

I am not sure how I would do this, how would Power BI 'know' I had authenticated?

Let me write an example. If you create a table at excel sharepoint with the following columns: 

clientid | clientsecret | user | password

Get data from the excel file. Then you can get the string of each column to authenticate at the API. You are not writing text at the powerbi literally and you can get data from the API.

Once you have connected to the API and before close & apply, click on the excel and "don't load" the table. That way it won't be visible for the model.

I hope that make sense

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

That worked!

awesome, thanks, you've really helped me here!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors