Easily get an access token for the Power BI Embedded Playground

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yo Adam Saxon with Guyana cube and in this video I'm gonna show you how you can easily get an access token to play with the power bi embedded playground stay tuned if you're finding us for the first time be sure to hit that subscribe button to stay up to date with all the videos from both Patrick and myself alright power bi embedded playground what the heck is that the playground is a webpage that you can go to try out power bi embedded without actually writing code so you can explore the JavaScript API you can explore reports dashboard all wait hang on enough of this talking let's head over to my machine actually look at it alright this is the power bi embedded playground as I mentioned it gives you those capabilities of exploring embedded reports from power bi you can see here that I've got options for all the different visual types here so reports report visual cue a dashboard tile so on and so forth we're gonna focus in on the report aspect of this and we will see that we've got some options here it looks a little scary especially if you don't have a developer background hopefully if you're using power bi embedded you have a developer background because you're gonna have to write some code but this allows you to at least explore what the possibilities are so one thing we'll start off with is you need to have some items here to tell it what report or dashboard or whatever it is you're embedding to go after we're focusing in on embedding a report and you'll see here it requires an embed token and embed URL and a report ID that embed URL is going to have the report ID and workspace ID as part of it or group ID and with those items I can just come over and say run and this will actually embed the report this comes with a sample item as well so all the items have samples you don't have to bring your own but the reason we probably want to play around with this is we want to see what our reports look like within this tool on how we can interact with our items to give it a test run and you'll notice before I said that it requires an embed token so what is an embed token an embed token is what's actually needed from an authentication standpoint because with power bi embedded it's for external users that don't know anything about power bi and probably don't even have a power bi login and so you need to proxy it through like a master account or a service principle and then they can get access to those items so the embed token is how we do this if we head over to the REST API documentation you can see that there are a bunch of items that you can call you have to call this for each item that you're embedding and the actual API element is generate token and that will give you the embed token that you can use with your application but that requires code you got to write it's a REST API you got to write some code to get that and I mentioned in the intro that we're gonna do this easily right we want to be efficient just for testing purposes so how do we get a token to use without writing code before we get into that I also want to just highlight real quick I said we want to do this with our own reports so let's take a quick look at the report we're gonna use so I'm gonna go over to my workspace it's my guy in a keyboard space I'm gonna go to reports and I've got a report here called slicers and filters and this is my report I've got the filter pane I've also got a filters tab where I've actually got some filters applied and we can go ahead and play around with it I want to play around with those from a JavaScript perspective a couple things you're gonna need to actually get this token is you're going to need the workspace ID or group ID and the report ID you can get those from the URL up above you can see I've got my group grid which is my workspace ID and then for reports I've got my report ID which is the grid that's listed there after reports excellent alright so how do we get this token easily efficiently right enter in the power bi powershell commandlets and so let's head over here so the powershell power bi command look for the power bi powershell commandlets our a command let that you can use to interact with the power bi rest api is if we look under profile one of the things we have here is get power bi access token it does exactly what it says it's gonna give us that token by just entering in a single command not writing code which is awesome all right so let's take a look and see how this works so let's go and login alright we are logged in with my guy in a cube account you will need to log in with an account that has access to the content so in this case you have to be a member of the workspace also you need to either have a pro license or be backed by premium capacity technically you could do this off of your my workspace as well in which case you wouldn't need a pro license or the premium capacities because it's just in your my workspace so you could do that alright then let's run this command BAM there's our access token however it's a little cut off and we need to be able to copy and paste this into the app so let's run this again and we will add as string then we get our token so we want to copy everything except for the bearer piece in the beginning so just the actual raw token I'll copy that now let's head back over to the playground and what we're gonna do is we're gonna change this up so I'm gonna put in my token here one thing to note is the token that comes from the powershell commandlets from that actual access token command is not an embed token this is actually your as your ad access token and so we do need to flip the switch and go to a ad token instead of embed token so just remember to do that I'll have to copy this again because I didn't flip it alright now we need our embed URL and a report ID I will grab those again you can get those IDs from the URLs with inside a power bi and then I need my report ID base that in and we'll go run it this should show my report and we need to make sure we actually put the grid only in the report ID oops it's gonna run that again and bam there's my report excellent alright and we can see that I've got my filter pane right let's head over to my filter page because I said what we want to do is interact with the filters from a JavaScript perspective so once you've run the report we can just go over to the interact tab and you'll have all the options that you can do from a JavaScript perspective and so we'll see filters and slicers here and I'm gonna say get page filters because the filters that are displayed on the filter pane it shows those are page filters and there's my JavaScript code and just copy and paste this into my application if I wanted but we're gonna go and run it and it will then display for me the filters that are actually being on the report page I can change this let's change it to Australia if I run this again you will then see now the Australia value is there so this is real code this is working I didn't write any of it but it's working then I could also come down and we could see hey let's remove those page filters and bam filters are gone right this is cool you can do all this stuff is great alright but what if you actually wanted the embed token remember I said that that token that the PowerShell command gave me was my as your ad token not an embed token if we go back and look remember embed token is just a REST API call right so I'm gonna do get a report and I'm gonna use the generate token item off of that to get that embed token once you've crafted that out if we go back to the power bi powershell commandlets you will see another command here where you can invoke a power bi rest method so this means we can actually go run the embed token command without writing any code right we just need to format the URL that's needed and then run it I don't have to do any of the heavy lifting of writing code to get that so that's an option that you can use if you do really want to get the embed token to use in the playground what do you think is this cool did you know about this is you know or have you even used the playground before let me know down in the comments below I want to hear it if you like this video be sure to hit that big thumbs up button smash it if you so desire if it's your first time here hit that subscribe button and as always from Patrick and myself thank you so much for watching keep being awesome and we'll see you in the next video
Info
Channel: Guy in a Cube
Views: 55,820
Rating: undefined out of 5
Keywords: power bi embedded, power bi embedded javascript, power bi embedded playground, power bi embedded report, power bi embedded rest api, power bi embedded tutorial, power bi, power bi developer, power bi developer api, power bi developer tools, power bi powershell, power bi powershell commands, bi, business analytics, business intelligence, embed, embedding, javascript, powerbi, powershell, rest api
Id: f7HLyiAk-lQ
Channel Id: undefined
Length: 8min 21sec (501 seconds)
Published: Thu Apr 04 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.