Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Store client credentials securely

I am retrieving an access token by calling an API and then use this access token to obtain employee data. I'm using a blank query with the following code.



    Source  = Json.Document(Web.Contents(baseUrl,
          RelativePath = "oauth/issueToken",
          Headers = [#"Content-Type"="application/x-www-form-urlencoded"],

    token = Source[access_token],

    data= Json.Document(Web.Contents(baseUrl,
        RelativePath = "api/employees",
        Headers = [#"Authorization"="Bearer "&token]




I'm getting access token calling our own API (not using AAD). What is the best way to store these client credentials (client_id and client_secret) instead of hardcoding in the code?

Responsive Resident
Responsive Resident

Besides the great option @lbendlin mentioned, with an additional API endpoint you could also use the builtin credentials manager


Super User
Super User

store them in a text file in a sharepoint document library that only you have access to. Then retrieve that file as part of the Power Query transforms etc.

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.