Power BI PowerShell and the Admin API

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yo Adam Saxon here guy in a cube and in this video we are gonna look at the new admin api's and the new power bi powershell commandlets but wait all you non admin folks there is something in here for you all so stay tuned I'm really stoked about these admin api's and the powershell commandlets for power bi this opens up a lot of doors especially for you admins out there cuz now you can actually go and look at the different content inside of your tenant so this includes workspaces reports dashboards datasets tiles all of it across your entire organization for any user if you are an admin to be able to use the admin portion of this you're going to need to be either a global admin for your tenant or a power bi service administrator you need to be in that role from an office 365 perspective for your account when you log in and I mentioned there's something here for everyone not just admins I promise I will get to that hopefully you'll be as excited about it as I am but enough talking let's head over to the computer alright so what I've got up here right now is the REST API documentation for power bi so this is where you can go figure out all the actual api's that are available that you can use from a REST API perspective and there's a section in here for admin and in here it lists all of the actual admin operations that you can do so these are the specific api's that you can go after so this includes dashboards it includes datasets it includes groups of groups would be the workspaces and a couple of other items that are in here so it get reports all of that stuff get imports so these are the actual p bi x files that are out there so when you click on one of these so get dashboards it's going to give you a URL so even from the non admin API s it's going to give you a URL for that REST API that you can call and so we can end up actually issuing a get command to this REST API to this actual URL if we have our actual authentication token it'll work so generally the problem with calling these REST API is you need to do a lot of heavy lifting to get into this you got to create an app registration you got to make sure the permissions are set up correctly for that app registration you've got to do grant permission step it's just a bunch of stuff that you got to deal with even if you're not an admin if you're just wanting to call those REST API is you've got to do a lot of work upfront to get it going and that part from my experience has caused a lot of confusion for people because they're not used to that I've done a lot of videos that talk about how to set up that app registration and how you can actually call those api's it's a lot of work it's detailed you almost you almost need to be a developer to even understand all of this stuff so in order to illustrate what these do I'm not gonna actually call the raw api's yet what I want to do is introduce you to the power bi powershell commandlets because what these powershell commandlets do is they wrap these api calls for you and they make it really easy to go use let me jump over to the documentation for the powershell commandlets and all have links for the rest api documentation and the powershell documentation down below in the description go check it out okay so this is the documentation for the powershell commandlets alright to show you how easy it is to use this I'm just gonna scroll down a little bit we can just copy this install module just grab that or you can hit the copy up here and we're gonna go over to an admin PowerShell window just gonna paste that in hit enter and it will install I'm gonna say a for all and then boom we now have our powershell commandlets for power bi so let me do this let's go over to the PowerShell ISE and we'll just play around with this a little bit just to show you how easy this is so let's do login power bi and we'll do let's just get all of the workspaces in our environment and I'm gonna put this into variable so and this will be clear here in a second so let's do get power bi and we'll say let's go down and choose workspace so I want to get all the workspaces that are in my tenant by default this is going to be under my individual usage and so this is where this comes in handy for you non admins is you can actually get an inventory of your items alone that you have access to by using these powershell commandlets without needing to set up all the API stuff right so if i go and run the it's going to go and just get me the workspaces that I have so we'll print this out and then we'll do we'll just get a count of those items so we'll see all the items that are there and then we'll get a count of those items and we'll see what's going on so first what I want to do let's just go ahead and log in to power bi and this is gonna be your the login that you login with to the power bi service itself all right I'm logged in one cool thing that it would give you is your tenant ID if you ever needed that but it's there for it's an easy way to get it and then what we're gonna do is we're gonna go ahead and run this so this is going to get the workspaces that are in the system it's going to run it so here's a list of all the the workspaces that are in my system or that are there that my login has access to and there's a total of 15 workspaces that I can get to in my tenant awesome but now I want to see as an admin only see all the workspaces in my tenant check this out all right so all I need to do is add a scope to this so let's do scoop and we're gonna say organization by default it's individual but we won't change it to organization so this means it's actually gonna call those admin rest api's boom there we go there's everything and it came back with 99 workspaces and one thing you can see here is you can see the personal workspace so these are the my workspaces in the system so I can see all the my workspaces plus all the app workspaces that are in my tenant that's pretty cool right so as an admin I can now see all the content in my organization easy peasy nothing to it so all I had to do is log in and I called those api's one thing you didn't see me do is I didn't have to go register an application in Azure Active Directory I didn't have to supply that application ID and I didn't have to do all the hard lifting of calling an API I just called get power bi workspace that's it it's awesome alright so what if I wanted to call those REST API is but I didn't want to deal with all of that headache of the app registration and writing code and all of that stuff check this out there is a command called it is called invoke power bi rest method if we go look at the documentation for this you can see here this will actually invoke the power bi REST API so you can put any rest method you want in here for the URL what you do is you take you take the part of the URL that you want so if I wanted to say it's gets let's go down and just get groups groups we'll do get groups so you would take whatever this URL is passed the my org right so this part you would leave off and then you would just add the rest of it so if I wanted to do let's see if I can find a good example alright so a good example here would be get datasets in group let me get a group ID so let's do that real quick let's get we will pump out our workspaces I mean we've off the organization cuz I just want one of mine so let's do this alright so I'm gonna grab this API let me copy that out or sorry the grid I'm gonna copy the grid alright and then if we go back to our item so what I would do here is do grid and then data sets so this mimics if I bring let's bring this down so we can see them side by side so this mimics the URL that we want - the my ERG and everything before it so it starts with the groups part and then the grid and then the datasets part and so with this will do is it will get me a list of all the datasets inside of that group for this user so I can run that and then BOOM this is the actual JSON response from the REST API call so I can call those REST API s no problem I didn't have to do any of the headache of getting all that stuff to work outside of it so this is great let's take a look at some other things that we can do here let's just explore I just want to call these out so you're aware of them these are the powerful things you can do with this so if I go into the workspaces part here we're gonna have items here that we can do so we can add a user to workspace we can remove a user from a workspace we can restore a deleted workspace that's there and then we can also do a set operation on the workspace which will actually just update the description and whatnot so these workspace items will only work with the new workspaces that are available you're gonna hit issues with it if you try and use it on the old workspaces so once the new workspace preview is out you can use these to manage the users in there which means you could actually as an admin go find all the groups or find all the workspaces out there that are in the organization and maybe in your organization you want to say look I've got this IT security group that I want added to every workspace in my organization you can go through and then add that security group to all the workspaces that don't have that security group there and then boom you will see all of them also there I mentioned the import command that is there so let's look at that so if we go on to reports we can say get power bi import this will get the listing of the P bi x files within a given area so then what I can do is then I can call export power bi report and this will get those pbi x files out of an actual workspace this will export the P bi X file and put it down on your disk so consider this scenario as an admin I know that someone in my organization published a p bi X file to their my workspace so only they have access to that workspace and then that user leaves the organization I can go get that P bi X and then re-upload it to an app workspace that's pretty cool huh like I mentioned before to start these PowerShell commands are only there and the admin api's are only there right now for content so this is workspaces dashboards reports and data sets alright I know what your next questions gonna be I know it I can hear I already hear you typing into the comments what about gateways how do we find the gateways in our organization hang on hang on it's coming it's coming so first this is the first wave of the admin api's that are available for you and this is available in the powershell commandlets the Gateway items will be coming there will be iterations on the admin api's that are available for you and subsequently the powershell commandlets that go with those as well and so that'll let allow you to manage these from an api perspective and then hopefully later on we'll see management items like this available with inside of the service itself I don't know we'll have to wait and see and then for you not admins you can run these commands and at least get some inventory items so that you can figure out what you've got out there and we'll manage some things maybe even manage some workspaces that you own from a PowerShell command live and you can script some of that that's pretty cool all right guys what do you think let me know down in the comments below are you excited about this is this like something you've been waiting for does this open up possibilities I'm very excited to see what you guys are gonna do with these powershell commandlets and the admin api's and just things you're gonna do in the enterprise I want to hear about it let me know down below in the comments if you like this video give it a big thumbs up smash it if you so desire if it's your first time here hit that subscribe button and as always from both 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: 33,268
Rating: undefined out of 5
Keywords: Power BI Powershell And The Admin API, power bi powershell, power bi powershell cmdlet, admin api, power bi, power bi admin, Power BI admin api, power bi admin role, power bi admin roles and responsibilities, power bi administration, power bi administration training, power bi demo, power bi inventory, power bi inventory management, power bi tutorial, powershell, rest api, administration, business analytics, business intelligence, microsoft, powerbi
Id: SQ7ufcRayYY
Channel Id: undefined
Length: 12min 34sec (754 seconds)
Published: Tue Aug 07 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.