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
– Register the Power BI app in Azure.
-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.
Register App in Azure.
- Search for App Registration under More Services.
- Select New application registration.
- – Set a name.
– Select Native type.
– Set this redirect URI:
Apply permissions to your appliocation within Azure AD.
- Select the newly created app within App Registrations section.
- Select required permissions menu.
- Open the Windows Azure Active Directory API and select “Access the directory as the signed-in user”. Save.
- Open the Power BI Service API and select all permissions under Delegated Permissions. Save.
- 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.