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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

REST API Basic AUTH

I am making a content pack for Power BI.

I am using REST API, but I have to use basic AUTH.

 

I need to pass the username and the password as parameters for the API call, not just a plain txt. So anyone can put in their own username and password and connect their own data to that content pack.

 

    let
   actualUrl = "https://XXX/api/c/entities?type=TEM",
   options = [Headers =[#"Content-type"="application/json",
              #"Authorization"="Basic <User : Password>"]],
   result = Web.Contents(actualUrl, options)
in
    result

 

How can I pass that user and password as parameters into the code? Or, is there any workaround?

 

Thanks in advance!

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may have a look at below post. If it is not your case, you may submit a support ticket.

https://powerbi.microsoft.com/en-us/support/

 

https://community.powerbi.com/t5/Report-Server/Power-BI-REST-API-authentication/td-p/295470

 

Regards,

Cheriee

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello v-cherch-msft

 

I have already seen those links, but I have to use M Formula Language.

 

I think I have found a partial solution:

 

 

let
   Source = let

   data = [    path= "/code",
               recursive=false,
               include_media_info=false,
               include_deleted=false,
               include_has_explicit_shared_members=false
            ],
   actualUrl = (InstanceURL) & "/api/c/entities?type=STR",
   Headers =[  #"User"=(Username),
               #"Pass"=(Password),
               #"Content-type"="application/json"
            ],
   result = Web.Contents(actualUrl, [Content=Json.FromValue(data),Headers=Headers])

   in
      result
in
   Source

 

It does log in if I do not add this piece of code:

 

& "/api/c/entities?type=STR"

 But from the moment I add that piece of code it doesn't log in.

 

Note: InstanceURL, Username and Password are parameters.

 

Thanks for your time!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.