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
namratapawale
Frequent Visitor

Retrieve username from current data connection

Hi,

 

I have a use case where I'm writing a custom M function that requires the username from the current data connector's connection. For example, I am connected to Teradata database using teradata database credentials, and I want to retrieve the username that was used while authenticating to Teradata database in my custom M function.

I'm defining this M function in custom data connector. I tried using Extension.CurrentCredential()[Username] to get the username from credentials but got the following error:

Expression.Error: We can only perform this operation while using a custom data connector.

 

Is there a way to do this?

 

Thanks,

Namrata

 

 

1 ACCEPTED SOLUTION

By design (and for security reasons), it is not possible for queries to access credential information. 

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Looks like another one for @ImkeF


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I'm not familiar with this function. If nothing comes up here, I'd suggest asking on GitHub instead:   https://github.com/Microsoft/DataConnectors/issues  

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF,

 

Thanks for the reply! 

Extension.CurrentCredential() is mentioned in here in Data Connectors documentation:

https://github.com/Microsoft/DataConnectors/blob/master/docs/m-extensions.md#accessing-the-current-c...

 

Sure, I'll post this question on GitHub too.

 

Thanks,

Namrata.

By design (and for security reasons), it is not possible for queries to access credential information. 

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.