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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Protect my API Key when using HTTP POST method

Is there anyway for me to hide my API key in the below example? Any and all help is appreciated, thank you.

 

Identifying info has been obscured. This will be part of a PBIS report that will be published to an On-Premise PowerBI Report Server, not PowerBI in Azure.

 

let
    url = "https://manage.example.com/SecurePages/API/API_Query.ashx",
    headers = [#"Content-Type" = "application/x-www-form-urlencoded"],
    postData = [
        Client_ID = "1234", API_KEY = "My Super Secret base64 encoded username:password"
    ],
    response = Web.Contents(
        url,
        [
            Headers = headers,
            Content = Text.ToBinary(Uri.BuildQueryString(postData))
        ]
    ),
    jsonResponse = Json.Document(response)
in
    jsonResponse

 

 

 

 

 

  

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Could you tell me if my post helps you? If it is, kindly Accept it as the solution to make the thread closed. More people will benefit from it.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

 

 

Eyelyn9_0-1638343036439.png

 

you can attach your API key directly to the API request. (I think these operations only suitable when you work with a test data source or test in a secure environment)

If you are work with a production environment or do these operations in no security network/devices, they may cause security issues for API key leakage.

For this scenario, It should more suitable to move these verify steps into your query steps and only generate the tokens when your query steps processed. (for the requests which power bi processed, they are been encrypted by power bi)

 

A similar thread: https://community.powerbi.com/t5/Developer/Protection-of-API-Keys-Stored-in-Parameter/m-p/1564020

 

Refer to:

Power BI-Whitepaper zur Sicherheit - Power BI | Microsoft Docs

Power BI-Whitepaper zur Sicherheit - Power BI | Microsoft Docs

 

 

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

lbendlin
Super User
Super User

I have seen scenarios where the API key is sourced from a separate query (like a text file stored on an on-prem web server).  You'll need to to feed the formula firewall monster though so your mileage may vary.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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