Skip to content

Commit b36aa38

Browse files
committed
Discuss the graph query selector more
1 parent 3f38076 commit b36aa38

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/build-your-software-catalog/sync-data-to-catalog/cloud-providers/azure/azure-resource-graph.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,39 @@ resources:
121121
```
122122
</details>
123123
124+
### The `graphQuery` selector
125+
126+
The `graphQuery` selector is a powerful feature that allows you to specify a custom query to fetch the exact Azure resources you need. It uses the [**Kusto Query Language (KQL)**](https://learn.microsoft.com/en-us/azure/governance/resource-graph/concepts/query-language).
127+
128+
With `graphQuery`, you can:
129+
- **Filter resources** based on their properties, tags, or any other attribute.
130+
- **Select specific properties** to reduce the amount of data ingested.
131+
- **Join different resource tables** to enrich the data.
132+
- **Perform aggregations** and other advanced operations.
133+
134+
:::tip Optimizing your `graphQuery`
135+
It is highly recommended to optimize your `graphQuery` to fetch only the data you need. A well-crafted query can significantly improve the performance of the integration and ensure that your software catalog is not cluttered with unnecessary information.
136+
137+
For example, instead of fetching all resources and then filtering them in the mapping, you can use the `where` clause in your query to filter the resources at the source.
138+
:::
139+
140+
Here is an example of a broad query versus an optimized query:
141+
142+
**Broad Query:**
143+
```kusto
144+
resources
145+
| project id, type, name, location, tags, subscriptionId, resourceGroup
146+
```
147+
148+
**Optimized Query:**
149+
```kusto
150+
resources
151+
| where type in~ ('microsoft.compute/virtualmachines', 'microsoft.storage/storageaccounts') and tags.environment == 'production'
152+
| project id, type, name, location, tags, subscriptionId, resourceGroup
153+
```
154+
155+
The optimized query fetches only virtual machines and storage accounts that have the `environment` tag set to `production`, which is much more efficient.
156+
124157
## Setup
125158

126159
To set up the Azure Resource Graph exporter, you'll need to configure both Port credentials and Azure app registration.

0 commit comments

Comments
 (0)