Skip to content
3.0 preview2.3.0 stable

These docs describe the preview. Pick the version you run and every page marks what it doesn't have yet. Get the preview →
Maester 2.x docs (archived) →

Sponsor

Invoke-MtAzureResourceGraphRequest

Invoke a query request to the Azure Resource Graph.

Invoke-MtAzureResourceGraphRequest [-Query] <String> [[-ApiVersion] <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

This function allows you to query resources across Azure subscriptions using Azure Resource Graph. It provides a simplified interface for resource discovery and exploration.

Invoke-MtAzureResourceGraphRequest -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachines'"

Lists all Azure virtual machines

Invoke-MtAzureResourceGraphRequest -Query "ResourceContainers | where type=='microsoft.resources/subscriptions'"

Lists all Azure subscriptions

The Resource Graph query to execute using KQL (Kusto Query Language)

Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The API version to use for the Azure Resource Graph REST API

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: 2021-03-01
Accept pipeline input: False
Accept wildcard characters: False

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

https://maester.dev/docs/commands/Invoke-MtAzureResourceGraphRequest