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
PowerbiStarter
New Member

Secure write back possible in custom visual?

Hi PowerBI community,

I have a question:
- Is it possible to -in a secure way- implement write back functionality in PowerBI using custom visuals?
- if so, how?
- if not, please explain what the blocking piece is

Details
- please note that I have already a working .pbiviz that does write back functionality (it can call an external api using jQuery). I have verified that I was able to post datapoints from powerbi to this api that is hosted on a different server

Only question is security related
- Now this external api is “open”: no authentication required
- My question is if (and how) I can authenticate myself against this external api so only authenticated users in PowerBI can call the apu

Use case
- we have a clients that have this requirement, and are flexible in how to exactly organize this

Please let me know what is (or is not) possible

Thanks!
1 ACCEPTED SOLUTION

Authentication is on backlog. It'll be considered soon.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

12 REPLIES 12
nivasnalla
Frequent Visitor

If possible, could you please share the code snippet used to call the external API. I am finding hard to make it work.

You just need to produce an AJAX call to remote server via request, jquery, or other libraries.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

// inside the custom visual contructr

document.body.innerHTML = '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>'
+'<input id="txtname" type="text" /></p>'
+'<input id="InsertRecord" type="button" value="Insert"></input>'

let bttnClick = document.getElementById("InsertRecord");
bttnClick.addEventListener("click", (e: Event) => this.getCall());

// out side the constructor and inside the visual class

getCall(){

$(function() {
$.getJSON("https://api.ipify.org?format=jsonp&callback=?",
function(json) {
document.write("My public IP address is: ", json.ip);
console.log(json.ip)
}
);
});
}

 

I used the above to call an web api that returns the public IP to console and I am getting the below error

 

API Reference : https://www.ipify.org/

 

Uncaught TypeError: $ is not a function
at Visual.getCall (<anonymous>:627:25)
at HTMLInputElement.<anonymous> (<anonymous>:614:89)

 

I might be missing jquery reference somewhere, but I couldn't figure it out. Any help would be greatly appreciated, thanks in advance.

Please follow this guide to import jQuery into your custom visual. You just need to replace d3 into jQuery wiht a proper version.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

v-viig
Community Champion
Community Champion

Power BI CV API does not provide authentication mechanism so far.
We'd recommend to implement your own authentication that will ask user to log in.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Thanks for the reply.

It is not the answer I hoped for (user-experience-wize), but it is clear at least.

Also I hope this will soon be implemented; in Qlik and some other data visualization tools you have ways to do this, and I see these kinds of requests more and more...

Authentication is on backlog. It'll be considered soon.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

Is there any update regarding the Authentication?
We have the same client requirement - How can I authenticate myself against this external API so only authenticated users in PowerBI can call the API.

v-viig
Community Champion
Community Champion

Auth API for Microsoft Services is in progress. No particular ETA yet.

 

For external services you should use OAuth of other methods for authentication.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Hello:

Is there any update on this?

Hi @v-viig 

 

What is the status of the Auth Api for Microsoft Services?

 

Thanks

 

Stefan

Super; thats good news. Thanks for the quick reply again!

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.