Power BI is a extremely powerful data and visualization tool. It have opened a new world for me. But the first thing i always think about when taking a look at Microsoft products, there have to be a way to control this with PowerShell. I did not find any good information about any PowerShell module on the product pages. After some googling i found a module on the PowerShell gallery that have been created by what i believe is a Micrsoft employee. What was suprising was that the module have been out for about 7 months and have barely 130 downloads. Why haven’t this been so popular? Hopefully i can help change this with a series of blog posts looking at the possibilities of Power BI and PowerShell.
First article is going to take a look at what is needed to get started and set up the connection/integration.
What is needed:
– Azure active directory tenant and organizational user.
– Register an Power BI App
-Apply permission to your Application in Azure AD
– Install PowerShell module for PowerBI
Register Power BI App.
- Go to dev.powerbi.com/apps.
- Sign in with your existing account.
- Set App Name.
- For PowerShell use you select Native app.
- Enter this as a Redirect URL:
- Sellect all APIs. Check here for more infoprmation on there permissions:
- Register App.
- Take note of Client ID.
Give app permissions in Azure.
- Search for App Registration under More Services.
2. Select the newly created app within App Registrations section.
3. Select required permissions menu.
4. Open the Windows Azure Active Directory API and select “Access the directory as the signed-in user”. Save.
5. Open the Power BI Service API and select all permissions under Delegated Permissions. Save.
6. Select Grant Permissions.
Now its time to install the Power BI module and its dependancies.
Since its on the PowerShell Gallery, its as simple as opening a PowerShell window and enter:
Install-Module -Name Microsoft.ADAL.PowerShell
Install-Module -Name Microsoft.PowerBI.PowerShell
You can read more about the module here:
We are now all set to start sending data into Power BI from PowerShell.
In the next part/blog article i will take a look at how we use the Power BI module and how to visualize the data in Power BI reports.