Search-AzGraph
Mengkueri sumber daya yang dikelola oleh Azure Resource Manager.
Sintaks
Search-AzGraph
[-Query] <String>
[-Subscription <String[]>]
[-First <Int32>]
[-Skip <Int32>]
[-SkipToken <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Search-AzGraph
[-Query] <String>
-ManagementGroup <String[]>
[-AllowPartialScope]
[-First <Int32>]
[-Skip <Int32>]
[-SkipToken <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Search-AzGraph
[-Query] <String>
[-UseTenantScope]
[-AllowPartialScope]
[-First <Int32>]
[-Skip <Int32>]
[-SkipToken <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Deskripsi
Pelajari selengkapnya tentang sintaks kueri di sini: https://aka.ms/resource-graph/learntoquery
Contoh
Contoh 1
Search-AzGraph "project id, name, type, location, tags" -First 3
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt
name : nt
type : microsoft.compute/virtualmachinescalesets
location : eastus
tags : @{resourceType=Service Fabric; clusterName=gov-art-int-nt-a}
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.EventGrid/topics/egtopic-1
name : egtopic-1
type : microsoft.eventgrid/topics
location : westus2
tags :
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.EventGrid/topics/egtopic-1
Kueri sumber daya sederhana yang meminta subset bidang sumber daya.
Contoh 2
Search-AzGraph "project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"
location count_
-------- ------
eastus 66
westcentralus 32
westus 26
Kueri kompleks tentang sumber daya yang menampilkan pemilihan bidang, pemfilteran, dan ringkasan.
Contoh 3
$response = Search-AzGraph -Query "project id, name, type, location" -First 2
Search-AzGraph -Query "project id, name, type, location" -SkipToken $response.SkipToken
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/test/providers/Microsoft.Network/networkInterfaces/17ni
name : 17ni
type : microsoft.network/networkinterfaces
location : westeurope
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/test/providers/Microsoft.Network/networkInterfaces/17ni
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/test/providers/Microsoft.Network/networkSecurityGroups/17nsg
name : 17nsg
type : microsoft.network/networksecuritygroups
location : westeurope
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/test/providers/Microsoft.Network/networkSecurityGroups/17nsg
Kueri dengan token lewati yang diteruskan dari hasil kueri sebelumnya. Harap dicatat bahwa menyimpan id dalam hasil wajib untuk mendapatkan kembali token lompati.
Contoh 4
Search-AzGraph -Query "project id, name, type, location, tags" -First 2 -ManagementGroup MyManagementGroupId -AllowPartialScope
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt
name : nt
type : microsoft.compute/virtualmachinescalesets
location : eastus
tags : @{resourceType=Service Fabric; clusterName=gov-art-int-nt-a}
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.Compute/virtualMachineScaleSets/nt
id : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.EventGrid/topics/egtopic-1
name : egtopic-1
type : microsoft.eventgrid/topics
location : westus2
tags :
ResourceId : /subscriptions/1ef51df4-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/Service-INT-a/providers/Microsoft.EventGrid/topics/egtopic-1
Kueri yang dilingkup ke grup manajemen yang memungkinkan kueri berhasil dengan hasil cakupan parsial jika MyManagementGroupId memiliki lebih dari langganan N di bawahnya. N adalah jumlah maksimum langganan yang dapat diproses oleh server.
Parameter
-AllowPartialScope
Menunjukkan apakah kueri harus berhasil ketika hanya sebagian jumlah langganan di bawahnya yang dapat diproses oleh server
Jenis: | SwitchParameter |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-DefaultProfile
Kredensial, akun, penyewa, dan langganan yang digunakan untuk komunikasi dengan Azure.
Jenis: | IAzureContextContainer |
Alias: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-First
Jumlah maksimum objek yang akan dikembalikan. Nilai yang diizinkan: 1-1000. Nilai default adalah 100.
Jenis: | Int32 |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-ManagementGroup
Grup manajemen untuk menjalankan kueri.
Jenis: | String[] |
Position: | Named |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Query
Kueri Resource Graph.
Jenis: | String |
Position: | 0 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-Skip
Mengabaikan objek N pertama lalu mendapatkan objek yang tersisa.
Jenis: | Int32 |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-SkipToken
Lombah token yang akan digunakan untuk mendapatkan halaman hasil berikutnya jika berlaku.
Jenis: | String |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Subscription
Langganan untuk menjalankan kueri.
Jenis: | String[] |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-UseTenantScope
Jalankan kueri di semua langganan yang tersedia di penyewa saat ini.
Jenis: | SwitchParameter |
Position: | Named |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | False |
Terima karakter wildcard: | False |
Input
None