Modifier

Partager via


Get-AzResourceGraphQuery

Get a single graph query by its resourceName.

Syntax

Get-AzResourceGraphQuery
   -ResourceGroupName <String>
   [-SubscriptionId <String[]>]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzResourceGraphQuery
   -Name <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String[]>]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzResourceGraphQuery
   -InputObject <IResourceGraphIdentity>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]

Description

Get a single graph query by its resourceName.

Examples

Example 1: Get all resource graph query under a resource group

Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test

Location Name            Type
-------- ----            ----
global   SharedQuery-t01 microsoft.resourcegraph/queries

This command gets all resource graph query under a resource group.

Example 2: Get a resource graph query by name

Get-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name SharedQuery-t01

Location Name            Type
-------- ----            ----
global   SharedQuery-t01 microsoft.resourcegraph/queries

This command gets a resource graph query by name.

Example 3: Get a resource graph query by objecy

$query = New-AzResourceGraphQuery -ResourceGroupName azure-rg-test -Name query-t03 -Location 'global' -Query 'project id, name, type, location' -Description 'test'
Get-AzResourceGraphQuery -InputObject $query

Location Name            Type
-------- ----            ----
global   SharedQuery-t01 microsoft.resourcegraph/queries

This command gets a resource graph query by object.

Parameters

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

Type:IResourceGraphIdentity
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the Graph Query resource.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The Azure subscription Id.

Type:String[]
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IResourceGraphIdentity

Outputs

IGraphQueryResource