Part 1: Setting up Azure Active Directory and registering your application
When the Power BI preview finally was released I was really intrigued by the Power BI API which among other things allow you to create dashboards that are updated in real time. Now, I am expecting my first child in under a month now and I thought that why not combine my background in cybernetics and embedded systems with my present, business intelligence. I have bought a Raspberry PI and I invite you to join my mission to hopefully create a baby sound monitor that will be updating a Power BI dashboard in real time to show how often, how loud and how long my baby is crying. Hopefully we will have a quiet baby that never screams and I’ll have to use this for registering baby laughter instead, but who knows right? You might not have a baby on its way, but maybe you have some other IoT project you want to do or just want to try out the Power BI API. Either way you’re invited to embark on this journey together with me!
I will make this into a series of post, but the journey starts with setting up your Azure Active Directory and getting to know the Power BI preview where a dashboard will get updated real time using the Power BI API later. In order to use the Power BI API you need to register the application you will be making in your Azure Active Directory. I also made a new user that I am going to use for my Power BI site.
Creating an Azure Active Directory
When you log into your Azure Management Portal you will find Active Directory on the navigation bar on the left. Click on Active Directory and the new button, choose App Services, Directory and click on Custom Create to create a new AD. Give it a name, a domain name and select the country for your directory. The country can’t be changed after the directory is made and affects which data center your AD will be located in so choose wisely, or just go with the country you’re in as I did.
When your directory is created it will show up under your Azure Active Directories. I have made a new user that I am going to use with Power BI and then signed up for a preview over at www.powerBI.com using this user from my Azure Active Directory. It might take some time to get a Power BI provision up for your Azure Active Directory organization so I would do this step before you read the rest of this post.
Registering your Power BI app
Before you can create your Power BI application you need to register your app in your Azure Active Directory. Click on the directory you created, go to applications and press add. You want to “add an application my organization is currently developing” and you want it to be a “native client application”. You are asked for a redirect URI where you can use https://login.live.com/oauth20_desktop.srf. Make sure when you start writing your program to use the same redirect URI in your code.
When your application is up you need to set some permissions for it. Click on your application, go to configure, scroll to the bottom of the page and press Add Application. Select “Power BI Service” and close the window. Power BI Service will show up under “Permissions to other applications”, but before you are done you have to check all three checkboxes in the dropdown “Delegated Permissions”.
And with that step: Congratulations! You are now ready to copy/paste the Client ID from your application and start using it together with the Power BI API. We will continue on that later. Feel free to play with the Power BI preview as well to familiarize yourself by f.ex uploading an Excel file as a data source and make some reports and dashboards. Personally I am looking forward to having more visualizations as I almost felt the word preview should have been emphasized more in this Power BI preview.
Other parts of the series can be found here:
Part 2: Real time dashboard using a Raspberry PI and Power BI