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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
samwoolerton
Regular Visitor

Authenticating an R or Python script

I was excited to see that Power BI now supports Python scripts, so I put together a quick script to get data from the Zendesk API.

 

With basic auth (username and password) hard-coded, this works in Power BI and pulls the data in. I really need this to work like any other Power BI data source though, and use the Power BI auth credentials/prompts.

 

Is this possible, and if so, how?

 

 

Note that I made a version of this script in both Python and R for testing purposes (I was hoping there'd be more docs for using R script with Power BI, as it has been around for longer). If it's not possible yet in Python but is doable in R, that's also an option.

1 ACCEPTED SOLUTION

Yeah I'm more comfortable with the few people I will work on the report with having access to my credentials than those who I'll share the report with.

 

Thanks for the help all, looks like hard-coding the username and password is the best option for me here

View solution in original post

5 REPLIES 5
zoloturu
Memorable Member
Memorable Member

Hi @samwoolerton,

 

The only approach would be:

1) Create Username and Password parameters. See example - https://www.youtube.com/watch?v=iiNDq2VrZPY

2) Use them in M (PowerQuery) script at the beginning

3) Then Populate them to R/Python script.

 

And then you will be able to open parameters window at any time. 

 

Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!

 

Hey Ruslan,

Thanks for the update here - Guyinacube videos are great!
 
Downside of this approach is that any user of the Power BI report can still see those parameters (they're not hidden away like credentials are for other data sources).
 
Any way to get around this?
 
Thanks,
Sam

@samwoolerton,

You can directly define parameters(user name and password) in Advanced Editor of your query in Power BI Desktop following the guide in this similar thread, and then create a Power BI report template(.PBIT) .

This way, when each user open the PBIT in Power BI Desktop, they will be prompted to enter username and password.

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.

@samwoolerton@v-yuezhe-msft,

 

On the one hand, approach sounds as an alternative but on the other hand, once you publish a report with such parameters to Power BI Service then your parameters will be opened to everyone who has access to a workspace. 

 

Regards,
Ruslan

Yeah I'm more comfortable with the few people I will work on the report with having access to my credentials than those who I'll share the report with.

 

Thanks for the help all, looks like hard-coding the username and password is the best option for me here

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors