Power BI client app sample
Published: November 1, 2015
Updated: July 19, 2016
Download the .NET getting started client app sample
Important To run the client app sample, you must register the sample app in Azure Active Directory (Azure AD), and get a Client ID. The Client ID is used to authenticate to Azure AD. See How to run the client app sample.
The Power BI client app sample shows you how to:
- Get an Azure Active Directory access token for authentication
- Create a dataset
- Get all datasets
- Add rows to a dataset and delete rows from a database
- Update a table schema
- Get tables
- Get groups
Note The client app sample also shows you how to call Power BI REST operations on Groups.
Details about the client app sample are in the Authenticate a client app topic or view the code on GitHub
The client app sample is a console application which shows you how to authenticate a Power BI client app to Azure Active Directory, and call all Power BI REST operations including Group operations. To run the sample you need to:
- Download the .NET getting started client app sample from GitHub
- Register the client app sample in Azure Active Directory
- Set Client ID you got from registering the sample app
Register the client app sample in Azure Active Directory
To call a Power BI REST operation in a client app, you need a Client ID to authenticate to ** Azure AD ** so that your app has access to the Power BI REST resources. To get a Client ID, you register the sample app in the Windows Azure Management Portal. Before you register the sample app, here are the settings you will need:
Client app sample registration settings
| Setting | Value | Description |
|---|---|---|
| Name | PowerBIClientSample | This can be any unique name. |
| Redirect Uri | https://login.live.com/oauth20_desktop.srf | For a client app, a redirect uri gives Azure Active Directory more details on the application that it will authenticate. You can use this redirect uri for your client app. |
| Permissions | View all Datasets, Read and Write all Datasets, and View users Groups | For more about Power BI permissions, see Power BI permissions. |
Register the client app sample
To register the client app sample, see Register a client app, and use the settings above. After you register the client app sample, Azure AD generates the Client ID for the app. To run the sample, you must set the clientID variable in the sample. You can get the Client ID from the Azure Application Configuration page. See How to get a client app id.
Set Client ID you got from registering the sample app
To run the sample, you must set the clientID variable in the sample. In Program.cs, set the clientID variable as follows:
private static string clientID = "{client id from Azure AD app registration}";
You can now run the client app sample.