Invoke-MtAzureResourceGraphRequest
Synopsis
Section titled “Synopsis”Invoke a query request to the Azure Resource Graph.
Syntax
Section titled “Syntax”Invoke-MtAzureResourceGraphRequest [-Query] <String> [[-ApiVersion] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]Description
Section titled “Description”This function allows you to query resources across Azure subscriptions using Azure Resource Graph. It provides a simplified interface for resource discovery and exploration.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”Invoke-MtAzureResourceGraphRequest -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachines'"Lists all Azure virtual machines
Example 2
Section titled “Example 2”Invoke-MtAzureResourceGraphRequest -Query "ResourceContainers | where type=='microsoft.resources/subscriptions'"Lists all Azure subscriptions
Parameters
Section titled “Parameters”-Query
Section titled “-Query”The Resource Graph query to execute using KQL (Kusto Query Language)
Type: StringParameter Sets: (All)Aliases:
Required: TruePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ApiVersion
Section titled “-ApiVersion”The API version to use for the Azure Resource Graph REST API
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: 2Default value: 2021-03-01Accept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
Section titled “Inputs”Outputs
Section titled “Outputs”Related links
Section titled “Related links”https://maester.dev/docs/commands/Invoke-MtAzureResourceGraphRequest