Redaguoti

Bendrinti naudojant


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.

    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.

    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.

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.

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.