Power BI is a suite of business analytics tools that help you analyze data and share insights. Rich dashboards are available on every device. You can combine data from many sources, including Analytics queries from Azure Application Insights.
There are three recommended methods of exporting Application Insights data to Power BI. You can use them separately or together.
- Power BI adapter - set up a complete dashboard of telemetry from your app. The set of charts is predefined, but you can add your own queries from any other sources.
- Export Analytics queries - write any query you want using Analytics, and export it to Power BI. You can place this query on a dashboard along with any other data.
- Continuous export and Stream Analytics - This involves more work to set up. It is useful if you want to keep your data for long periods. Otherwise, the other methods are recommended.
Power BI adapter
This method creates a complete dashboard of telemetry for you. The initial data set is predefined, but you can add more data to it.
Get the adapter
- Sign in to Power BI.
Open Get Data, Services, Application Insights
Provide the details of your Application Insights resource.
Wait a minute or two for the data to be imported.
You can edit the dashboard, combining the Application Insights charts with those of other sources, and with Analytics queries. There's a visualization gallery where you can get more charts, and each chart has a parameters you can set.
After the initial import, the dashboard and the reports continue to update daily. You can control the refresh schedule on the dataset.
Export Analytics queries
This route allows you to write any Analytics query you like, and then export that to a Power BI dashboard. (You can add to the dashboard created by the adapter.)
One time: install Power BI Desktop
To import your Application Insights query, you use the desktop version of Power BI. But then you can publish it to the web or to your Power BI cloud workspace.
Install Power BI Desktop.
Export an Analytics query
- Open Analytics and write your query.
Test and refine the query until you're happy with the results.
Make sure that the query runs correctly in Analytics before you export it.
On the Export menu, choose Power BI (M). Save the text file.
In Power BI Desktop select Get Data, Blank Query and then in the query editor, under View select Advanced Query Editor.
Paste the exported M Language script into the Advanced Query Editor.
You might have to provide credentials to allow Power BI to access Azure. Use 'organizational account' to sign in with your Microsoft account.
(If you need to verify the credentials, use the Data Source Settings menu command in the Query Editor. Take care to specify the credentials you use for Azure, which might be different from your credentials for Power BI.)
Choose a visualization for your query and select the fields for x-axis, y-axis, and segmenting dimension.
Publish your report to your Power BI cloud workspace. From there, you can embed a synchronized version into other web pages.
- Refresh the report manually at intervals, or set up a scheduled refresh on the options page.
401 or 403 Unauthorized
This can happen if your refesh token has not been updated. Try these steps to ensure you still have access. If you do have access and refershing the credentials does not work, please open a support ticket.
- Log into the Azure Portal and make sure you can access the resource
- Try to refresh the credentials for the Dashboard
502 Bad Gateway
This is usually caused by an Analytics query that returns too much data. You should try using a smaller time range or by using the ago or startofweek/startofmonth functions only project the fields you need.
If reducing the dataset coming from the Analytics query doesn't meet your requirements you should consider using the API to pull a larger dataset. Here are instructions on how to convert the M-Query export to use the API.
- Create an API Key
- Update the Power BI M script that you exported from Analytics by replacing the ARM URL with AI API (see example below)
- Finally, update credentials to basic, and use your API Key
Source = Json.Document(Web.Contents("https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups//providers/microsoft.insights/components//api/query?api-version=2014-12-01-preview",[Query=[#"csl"="requests",#"x-ms-app"="AAPBI"],Timeout=#duration(0,0,4,0)]))
Source = Json.Document(Web.Contents("https://api.applicationinsights.io/beta/apps/<APPLICATION_ID>/query?api-version=2014-12-01-preview",[Query=[#"csl"="requests",#"x-ms-app"="AAPBI"],Timeout=#duration(0,0,4,0)]))
If your application sends a lot of data, the adaptive sampling feature may operate and send only a percentage of your telemetry. The same is true if you have manually set sampling either in the SDK or on ingestion. Learn more about sampling.