How to Manage Power BI with PowerShell – An Example

June 18, 2019
Learn how you can use PowerShell to get more out of Microsoft Power BI. We provide a quick example that you can try on your own.
screenshot report in PowerBI


By: Mike Pierre-Louis
 
 
Microsoft has made Power BI even more powerful with its latest round of updates. Whether you are an admin or a user, the software’s new benefits are for everyone to enjoy. One of the main hurdles Power BI users had to overcome in the past was difficulties in triggering a Power BI dataset to refresh remotely. While it was eventually discovered that the task could be accomplished though 3rd Party API calls, there were a lot of overhead items that needed to be set beforehand. With the new updates to Power BI, Microsoft released what is called: “Power BI cmdlets”. Power BI cmdlets is a game-changer, since this allows anyone with the correct permission to do a great deal of things a lot more easily than ever before. For this blog post, we’ll be taking a look at how to view your datasets and workspaces with a few short commands.
 

Prerequisites:

1. Before we begin, we need to make sure we have PowerShell installed on the machine we’re planning to use. Here’s a link on how to do that.

2. Next, we need to install the Power BI cmdlets on our machine. Thankfully this is super easy to do. Open PowerShell ISE as an Administrator and copy and paste the following command: “Install-Module -Name MicrosoftPowerBIMgmt”. You will receive a few popups asking for permission to download. Click on “Yes to All”.
 

Let’s Begin

One of the main hurdles we had to overcome in the past was to allow a third party API to connect to a workspace to then trigger a refresh. Now the access is simple. In order to login, run the following command: “Login-PowerBI”.
 
View WorkSpaces and Details
• In order to view your own workspaces, you can run the following commands: “Invoke-PowerBIRestMethod -Url ‘groups’ -Method Get”

Power BI Rest Method

 

View Dataset and Details
• Similarly to the workspaces, we now have the ability to run the same command but replace groups with datasets. See example below:
 
Power BI Rest Method 2

 

Want to do more?

• Learn more about Microsoft Power BI Cmdlets for Windows PowerShell and PowerShell Core.

PowerShell Code Power BI

 

@GuyinaCube’s Youtube Channel has posted a video with more details about this topic.
• Insight Quest also has an article that shows how to take advantage of the new features of Power BI cmdlets and create a data refresh automation trigger.
 

Which commands would you like for us to review next?

So there you have it! This is just a snippet of the great new possibilities that are now available with PowerBI Cmdlets. Stay tuned for more! Which commands would you like for us to review next?
 

Questions?

Thanks for reading! We hope you found this blog post to be useful. Do let us know if you have any questions or topic ideas related to BI, analytics, the cloud, machine learning, SQL Server, (Star Wars), or anything else of the like that you’d like us to write about. Simply leave us a comment below, and we’ll see what we can do!
 

Keep your data analytics sharp by subscribing to our mailing list

Get fresh Key2 content around Business Intelligence, Data Warehousing, Analytics, and more delivered right to your inbox!

 


Key2 Consulting is a data warehousing and business intelligence company located in Atlanta, Georgia. We create and deliver custom data warehouse solutions, business intelligence solutions, and custom applications. 

Related Content
How to Use Copilot for Power BI

How to Use Copilot for Power BI

By: Mark Seaman   “Copilot” is Microsoft's new AI generative tool that’s now included in various Microsoft products, including Power BI, the highly popular data visualization platform. This integration is often referred to as "Copilot for Power BI". Copilot for Power...

Creating Folders in Power BI Workspaces

Creating Folders in Power BI Workspaces

By: Mark Seaman   Last month, Microsoft announced a new feature for Power BI Workspaces: folders. This addition allows teams to organize their Power BI workspaces more effectively, providing a clearer structure for collaboration and data analysis. Previously,...

Understanding Power BI Filters, Slicers, & Highlighting

Understanding Power BI Filters, Slicers, & Highlighting

By: Mark Seaman   Power BI has three powerful features that make understanding and analyzing your data and visualizations more impactful: filters slicers highlighting In this blog post, we explore the functionality of these three features.   Power BI Filters...