DO MORE using PowerShell Cmdlets for Power BI Service // Beginners Guide to Power BI in 2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video i want to show you how you can manage workspaces reports and data sets in power bi service using powershell commandlets i'm going to show you how you can do the same tasks that you would normally do in the web version except using the command line and also do some other tasks that are not normally possible for you such as restoring workspaces that you've deleted all of that and more so without further ado let's get started hi my name is fenan and welcome to the solutions abroad youtube channel where i focus on teaching beginners the wonderful world that is power bi i upload new videos every week so make sure you hit that subscribe button and the bell icon to get notified when a new one is out so don't be scared if you don't know much about scripting because everything here is quite self-explanatory and pretty easy to understand so a couple of things to bear in mind commandlets are just set of commands that you can send to the power ba servers in order to do or get something and these command lists are accessible through powershell which is the scripting environment that we can use and these commandlets have a list of sort of lightweight commands that you can do and control your power bi service if you have the right access for example adding people to workspaces or deleting workspaces adding reports refreshing data sets things like this so there are several reasons why you might want to be using commandlets so because everything is in a kind of scripting format it means that you can hook it up with external applications or automate things and tasks that you normally would have to do manually automatically using powershell scripting the second thing is that you will have access to some tasks that aren't normally available for you uh in the ui so for example as i said before restoring workspaces which i have not seen a way to do so just do using the powerbase service and i think at this point you can only do it in powershell scripting so we're going to go through it together from installation to usage with some examples so the first thing that you want to do is you want to head to the references documentation for the power bi commandlets for windows powershell and powershell core i'll leave a link for this website in the description box below but essentially as i said to you it's just a list of commands that you can use with the power bi service so these are the list of bits and pieces that you need to install these are just the different modules and each of these have different commands that you can control in the power bay service so for example you have some module for workspace so this is where you would you know manage workspaces add people in workspaces and it's just grouped that way essentially it's pretty simple if you've never worked with powershell before if you're using windows most likely powershell is already installed all you need to do is you need to install the module it's already here so you just click copy now it says that you need to do it in elevated powershell session so open here we'll type powershell and we need to run this as admin so now this is the elevated session all you need to do is just paste the install hit enter now it asks you to install just press a to install everything and just give it a minute to install all the modules now that the modules are installed you can actually start using them straight away and to use them you need to use the different scripting environment so it's powershell still just need to go to isc and this is where you'll be able to start using the commandlets now don't be alarmed that there's a scripting window here it's pretty simple to use now if you've never used powershell like me i've just learned it before this demo what you need to do you need to use this reference this is where you will learn what kind of stuff you can do so let's start with something simple right let's expand a couple of stuff here and then you'll see there are some kind of clues as to what they do for example you can do things like data flow related stuff profile related stuff but we'll look at the workspaces here and we'll just do a simple one so we want to just get power bi workspaces so it says here that it returns a list of power bi workspaces and you'll see you have some examples of how you can write well this is the list of what you can add and write and here's an example of how you would write it right so all you need to do is type get power bi workspace so let's start with that so let's type get dash power bi workspace hit tab and let's hit run here you see it gives us an error here which is normal because we haven't logged in yet obviously it doesn't know which power bi works this is you're looking at or which which account you want to use so we're going to use this account the solutions about uk demo account that i have so we have a bunch of workspaces here and we want to just see what kind of workspaces we have access to so we're going gonna create another one here and this one by the way it's it's here somewhere um you're gonna be able to i think there should be a log in here but i know the syntax so it doesn't need to be all you just need to do is just log in so all you need to do log in dash power bi or power bi service account doesn't matter so we'll run again and here's where you log in right so and this is how it knows which account to use we'll just log in really quickly so now you see it ran those two steps so we logged in and then it tried to get the workspaces so here it logged in as fernan and then you can see the three different workspaces that i have accesses the groceries northwind and some workspace and it has some information there about the workspace like ids and names and things like this keep a note of the id because we'll use that for something else later now what's great about powershell is that you don't really need to have an admin account in order to start using it for example with this one although we have a global admin account it doesn't necessarily mean that you can't use it it just means that you're limited to what functions or what commands you can use so for example you're an admin and this account has an admin account and you want to be able to see the workspaces that are in your tenant all you need to do is use the same code and instead you need to write scope as an attribute here and as default it uses individual which is your individual user but if you want to have an admin get power bi workspace we use organization again we'll highlight we can highlight that and just run just this code because we've already logged in so you'll see now it started giving us a bigger list so this is from where we we ran that code right so you see you have groceries which is we already know uh you can see north wind and you can look you can see who has access and what kind of access they have which is really important if you're an admin you see you can also see other things like deleted workspaces which normally you won't be able to see from the ui and also you'll see workspaces personal workspaces of different users within your tenant so you'll see personal workspace this is the my workspace bits right so you have the john's workspace and also jane's workspace which are the three different users that i have in the tenant so let's try and use another command in the command let's right so here let's have an example so let's say in the groceries workspace it doesn't really have anything um but if you look at the accesses here you see that we only have me so fernan as an admin now if let's say we want to do a task of adding people in this workspace now normally you'll be able to do it here right so we want to add jane here and we want to give her your access and that's how simple it is to add access to people in workspaces through the ui but let's say you want to do the exact same thing and you want to do it using the command list so let's have a look at doing that so again we want to look at the module workspace that's where you'd be able to do it and here there's a function here add power bi workspace user and you'll see it says it gives permissions to a specified user to access a power bi workspace exactly the same thing that we were doing in the ui except here we're going to scroll down here to some examples so you can see there's a couple of things that we want to use so this is the example right so we can just copy this but we want to try and type it ourselves so we want to use the function add workspace and we want to add several parameters to it right so first we want to say that this is this organization scope which basically means it's being done by an admin but i think at this point because we own the workspace it should be okay and the next um is the id which is the id of the workspace you want to add them to so as i told you before you make a note of the ids this is what we're going to use right so we know that the id of the groceries is this one wherever it is so we'll just copy it and then we'll save it here so that's the um what will you we'll use that later it also asks for the user email address which is what we're going to use so let's say we want to add in this case we want to add john so john smith we want to add so this is the email that we want to use that's pretty simple and then the last thing that you need to add is the access right so what kind of access right they have and here is an example so it this one this example is giving this person john an admin right but let's say we just want to give them a viewer and the sample kind of outputs or or values that you can add in the parameters are actually down here so here it says that you can add you can choose either member admin contributor and viewer but anyway there's a pop-up every time you you add a parameter to your command so let's let's follow it it's not not that difficult um so let's do add power bi workspace user that was the script so the first thing is going to go back here it says let's we need to add the scope so let's add scope here and organization the next is we want to add the id now the id i've already got it here that's the id of the groceries workspace and then we want to add the user email address so user principal name comes up because we logged in as power bi not the service account but anyway it doesn't matter all we have to do is put john's email address here at onmicrosoft.com and then the access right so access right we want viewer you see i didn't have to write so much the kind of pop-ups the intellisense does a great job at showing you what kind of parameters you can add and what functions you can use so now that looks done let's run that and i'm just selecting that and then run selection so now you see it's just giving us some warning so it says previous is supported when scope organization is specified it's just a warning but that doesn't mean it didn't work so let's have a look uh let's refresh this and let's have a look at the access again so now you see john is added there and it's all done through powershell we didn't have to do it through here and what's good is that because you can using powershell it means you can hook it up for some automation so if you want to add more people or you want to do bulk processes without having to do it in the ui manually you can do it and it's pretty simple to set up so let's try another example here we talked about restoring power bi workspaces and here it is in the reference restore power bi workspaces this allows you to restore a deleted power bi workspace so as far as i know this kind of control isn't available in the power bi service normally like here i'm not sure there is a way for you to do it and restore workspaces from here and the only way to do it is actually through here there are a couple of caveats to this to this function so the first of all is that you need to have a global admin or service administrator access to the tenant before you can use this so if you're just a normal user um the scope of this is normally organization so you won't be able to do it if you're not a global admin so the second thing is that it only supports new workspaces so any classic workspaces you probably won't be able to use this to restore those so now let's have a look at how it will actually work so here in my power bi service i have this workspace here some workspace and it has some stuff here grocery sales analysis some data sets some reports some dashboard um and let's say we uh delete this workspace and we want to restore it somehow so let's delete that so now you can see it doesn't exist anymore and as far as i know there is no way to restore it from this view and now we're gonna use this restore function this command to restore that workspace and so there are a couple of things we need so first we need to have the id of the workspace you want to restore the new name that you want to name this workspace and who is the admin for the workspace itself there are just three things it's not actually that that complicates it so the first thing as you remember is we need to get the uh id right so we're gonna hit run again here just running the get power bi workspace just to get the list of workspaces that exist right and because the scope is organization it means we have access to all the workspaces even the even the deleted ones so so some workspace here it is so you see it's deleted this sample workspace and we have the id here so that's what we need so we need the id all right and we'll just delete these uh we'll comment them out so it doesn't get too confusing so this is what we need the id so if you remember from the reference we want to do um restore power bi workspace so the three things that we need we need the id id id and then we will just put it here next we want to add the restored name which we'll name it restored some workspace doesn't really matter just name the new workspace then the last thing is who has the admin access to it right so we're gonna put just put ourselves admin user principal name uh and then i'll just copy this that's it so i'll highlight it hit run and again you see it gives you an uh warning it doesn't mean it didn't work so let's go back here now to our service let me just refresh this and when i click workspaces so here you are so you have this report this workspace which has all of the reports that are in the workspace restored even though it was deleted and that's really it for this video i hope it helped you understand how easy it is to start using power bi commandlets using powershell scripting i've created a patreon page where you can support the channel and get exclusive perks like early access to these videos all the demo files that we've created so far and credits to this video here the patrons that we have for this month thank you for supporting us if you want to be a supporter go support us on patreon get in touch using the social media links that are included in the description box below and thank you so much for watching guys see you again on the next one
Info
Channel: Solutions Abroad
Views: 284
Rating: 5 out of 5
Keywords: solutions abroad, power bi, powerbi, power bi tutorials, power bi for beginners, beginners guide to power bi, data analytics, dax, data modelling, data visualisation, business intelligence, power bi 2021, power bi cmdlets, cmdlets, power bi powershell, powershell powerbi, powershell cmdlets, power bi restore workspace, restore workspace power bi, restore groups power bi, how to automate powershell power bi, automation, power bi automations, power bi bulk operations
Id: _NTtgti056c
Channel Id: undefined
Length: 18min 9sec (1089 seconds)
Published: Wed Jun 30 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.