Skip to content

Latest commit

 

History

History
116 lines (74 loc) · 6.57 KB

File metadata and controls

116 lines (74 loc) · 6.57 KB
title Run queries with Azure Resource Graph Power BI connector
description In this quickstart, you learn how to run queries with the Azure Resource Graph Power BI connector.
ms.date 05/08/2024
ms.topic quickstart
ms.custom sfi-image-nochange

Quickstart: Run queries with the Azure Resource Graph Power BI connector

In this quickstart, you learn how to run queries with the Azure Resource Graph Power BI connector. By default the Power BI connector runs queries at the tenant level but you can change the scope to subscription or management group. Azure Resource Graph by default returns a maximum of 1,000 records but the Power BI connector has an optional setting to return all records if your query results have more than 1,000 records.

Tip

If you participated in the private preview, delete your AzureResourceGraph.mez preview file. If the file isn't deleted, your custom connector might be used by Power Query instead of the certified connector.

Prerequisites

Connect Azure Resource Graph with Power BI connector

You can run queries with Power BI Desktop or Power BI service. Don't use comments when you enter a query.

If you don't have a query, you can use the following sample that queries for storage accounts:

resources
| where type == 'microsoft.storage/storageaccounts'

After Power BI Desktop is installed, you can connect Azure Resource Graph with Power BI connector so that you can run a query.

The following example runs a query with the default settings.

  1. Open the Power BI Desktop app on your computer and close any dialog boxes that are displayed.

  2. Select Home > Options and settings > Data source settings.

  3. Go to Home > Get data > More > Azure > Azure Resource Graph and select Connect.

    :::image type="content" source="./media/power-bi-connector-quickstart/power-bi-get-data.png" alt-text="Screenshot of the get data dialog box in Power BI Desktop to select the Azure Resource Graph connector.":::

  4. On the Azure Resource Graph dialog box, enter your query into the Query box.

    :::image type="content" source="./media/power-bi-connector-quickstart/query-dialog-box.png" alt-text="Screenshot of the Azure Resource Graph dialog box to enter a query and use the default settings.":::

  5. Select OK. If prompted, enter your credentials and select Connect to run the query.

  6. Select Load or Transform Data.

    • Load imports the query results into Power BI Desktop.
    • Transform Data opens the Power Query Editor with your query results.

You need a workspace with Dataflow so you can connect Azure Resource Graph with Power BI connector and run a query.

  1. Go to your organization's Power BI service.

  2. Open a workspace and select New > Dataflow.

  3. Select Add new tables from Define new tables.

  4. In Choose data source type azure resource graph to search for the connector.

    :::image type="content" source="./media/power-bi-connector-quickstart/power-bi-service-get-data.png" alt-text="Screenshot of the get data dialog box in Power BI service to select the Azure Resource Graph connector.":::

  5. Select Azure Resource Graph.

  6. Enter a query into the Query box. You can copy and paste the query.

    :::image type="content" source="./media/power-bi-connector-quickstart/power-bi-service-query-dialog-box.png" alt-text="Screenshot of the Power BI service Azure Resource Graph dialog box to enter a query and use the default settings.":::

  7. Select Sign in to authenticate with your Organizational account.

  8. Select Next to run the query.

The results are displayed in Power Query. You can select to save or cancel.


Use optional settings

You can select optional values to change the Azure subscription or management group that the query runs against or to get query results of more than 1,000 records.

Option Description
Scope You can select subscription or management group. Tenant is the default scope when no selection is made.
Subscription ID Required if you select subscription scope. Specify the Azure subscription ID. Use a comma-separated list to query multiple subscriptions.
Management group ID Required if you select management group scope. Specify the Azure management group ID. Use a comma-separated list to query multiple management groups.
Advanced options To get more than 1,000 records change $resultTruncated to FALSE. By default Azure Resource Graph returns a maximum of 1,000 records.

For example, to run a query for a subscription that returns more than 1,000 records:

  • Set the scope to subscription.
  • Enter a subscription ID.
  • Set $resultTruncated to FALSE.

:::image type="content" source="./media/power-bi-connector-quickstart/query-dialog-box-options.png" alt-text="Screenshot of the Power BI Desktop Azure Resource Graph dialog box for a query using optional settings for scope, subscription ID, and $resultTruncated.":::

:::image type="content" source="./media/power-bi-connector-quickstart/power-bi-service-dialog-box-options.png" alt-text="Screenshot of the Power BI service Azure Resource Graph dialog box for a query using optional settings for scope, subscription ID, and $resultTruncated.":::


Clean up resources

When you're finished, close any Power BI Desktop or Power Query windows and save or discard your queries.

Next steps

For more information about the query language or how to explore resources, go to the following articles.