This post has already been read 809 times!
Power BI is an extremely powerful data and visualization tool. It has opened a new world for me. But, the first thing I always think about when looking at Microsoft products is that there must be a way to control this with PowerShell. I did not find any useful information about any PowerShell module on the product pages. After some googling, I found a module on the PowerShell gallery potentially created by a Microsoft employee. What's surprising is that the module has been out for about 7 months and does not have many downloads. Why hasn’t this been more popular? Hopefully I can help change this with a series of blog posts looking at the possibilities of Power BI and PowerShell.
Let's 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 a Power BI App
- Register the Power BI app in Azure.
- Apply permission to your Application in Azure AD
- Install PowerShell module for Power BI
Register Power BI App:
- Go to dev.powerbi.com/apps.
- Sign in with your existing account.
- Set App Name in the App Name box
- For PowerShell use select Native app.
- Enter this as a Redirect URL:
- Sellect all APIs. Check here for more information on there permissions:
- Click the Register App button.
- Make note of the Client ID.
Register the App in Azure:
- Search for App registrations under More Services.
- Select New application registration.
- In the form that pops up, do the following:
- Enter a name in the Name box.
- Choose Native in the Application Type drop down list.
- Set this redirect URL:
- Click Create.
Apply permissions to your application within Azure AD:
- Select the newly created app within App Registrations section.
- Select Required permissions menu.
- Open the Windows Azure Active Directory API, select Access the directory as the signed-in user and select Save.
- Open the Power BI Service API, select all permissions under Delegated Permissions and select Save.
- Select Grant Permissions.
Now it's time to install the Power BI module and its dependencies. Since its on the PowerShell Gallery, its as simple as opening a PowerShell window and enter the following:
Install-Module -Name Microsoft.ADAL.PowerShell
Install-Module -Name Microsoft.PowerBI.PowerShell
You can read more about the PowerShell module for Power BI here, Now, you are ready to start sending data into Power BI from PowerShell. In the next blog article, part 2, I will take a look at how we use the Power BI module and how to visualize the data in Power BI reports. In the part 3 blog article I will take you through the steps to automate in Azure.