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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dslForPBI
Helper I
Helper I

API call with embedded password

Is there an M language function or other facility to encrpt a password?  I have an api call written in Power query to extract data from an API and I am wondering if there is capabilty to encrpt/decrpt from within a power query?

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@dslForPBI,

 

What encryption/decryption functions would you like to get? Could you please post an example? In Power BI Desktop, when you connect to any data sources, Power BI will encrypt the password in PBIX file.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello v-yuezhe-msft--thanks for your reply!  Here is an example to demostrate what I am looking for.  In the snippet below, I am making an API call, so my data source is an endpoint which returns JSON.  I am making a POST using username and password embedded in "Web.Content" like so...

 

authCode = Text.Combine({"basic ",authCodeBinAsTxt}),
//
//Provide admin user name and password
//
ForJsonGen = Json.FromValue([grant_type="password",username="xxxxx",password="xxxxx",scope="RealTimeApi"]),
GetJson = Json.Document(Web.Contents(url,
[
Headers=[#"Accept"="application/json",#"Content-Type"="application/json",#"Authorization"= authCode],
Content = ForJsonGen
])),
FormatAsJson = Json.Document(Text.ToBinary(GetJson)),

 

I'd like to maybe parameterize it and use encryption if that is possible, make sense?

 

Thanks and Regards

@dslForPBI,

It is possible to parameter data source in Power BI Desktop, please take a look at the following similar thread and blog. But there is no built-in encryption function in Power BI, I would recommend you zip PBIX file and then set password/encryption.

https://community.powerbi.com/t5/Integrations-with-Files-and/Parameters-for-JSON-API-data-Maintain-Q...
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.