Megosztás a következőn keresztül:


Azure Resource Graph-minta lekérdezések az Azure Arc-kompatibilis Kuberneteshez

Ez a lap az Azure Arc-kompatibilis Kubernetes Azure Resource Graph-minta lekérdezéseinek gyűjteménye. Az Azure Resource Graph-minták teljes listájáért tekintse meg a Resource Graph-mintákat kategória és Resource Graph-minták táblázat szerint.

Minta lekérdezések

Az Összes Azure Arc-kompatibilis Kubernetes-fürt listázása Azure Monitor-bővítménysel

Az Azure Monitor-bővítményt telepített Azure Arc-kompatibilis Kubernetes-fürtök csatlakoztatott fürtazonosítóját adja vissza.

KubernetesConfigurationResources
| where type == 'microsoft.kubernetesconfiguration/extensions'
| where properties.ExtensionType  == 'microsoft.azuremonitor.containers'
| parse id with connectedClusterId '/providers/Microsoft.KubernetesConfiguration/Extensions' *
| project connectedClusterId
az graph query -q "KubernetesConfigurationResources | where type == 'microsoft.kubernetesconfiguration/extensions' | where properties.ExtensionType == 'microsoft.azuremonitor.containers' | parse id with connectedClusterId '/providers/Microsoft.KubernetesConfiguration/Extensions' * | project connectedClusterId"

Az Összes Azure Arc-kompatibilis Kubernetes-fürt listázása Azure Monitor-bővítmény nélkül

Minden olyan Azure Arc-kompatibilis Kubernetes-fürt csatlakoztatott fürtazonosítóját adja vissza, amely nem tartalmazza az Azure Monitor-bővítményt.

Resources
| where type =~ 'Microsoft.Kubernetes/connectedClusters' | extend connectedClusterId = tolower(id) | project connectedClusterId
| join kind = leftouter
	(KubernetesConfigurationResources
	| where type == 'microsoft.kubernetesconfiguration/extensions'
	| where properties.ExtensionType  == 'microsoft.azuremonitor.containers'
	| parse tolower(id) with connectedClusterId '/providers/microsoft.kubernetesconfiguration/extensions' *
	| project connectedClusterId
)  on connectedClusterId
| where connectedClusterId1 == ''
| project connectedClusterId
az graph query -q "Resources | where type =~ 'Microsoft.Kubernetes/connectedClusters' | extend connectedClusterId = tolower(id) | project connectedClusterId | join kind = leftouter (KubernetesConfigurationResources | where type == 'microsoft.kubernetesconfiguration/extensions' | where properties.ExtensionType == 'microsoft.azuremonitor.containers' | parse tolower(id) with connectedClusterId '/providers/microsoft.kubernetesconfiguration/extensions' * | project connectedClusterId ) on connectedClusterId | where connectedClusterId1 == '' | project connectedClusterId"

Az Összes Azure Arc-kompatibilis Kubernetes-erőforrás listázása

Az egyes Azure Arc-kompatibilis Kubernetes-fürtök listáját és az egyes fürtök releváns metaadatait adja vissza.

Resources
| project id, subscriptionId, location, type, properties.agentVersion, properties.kubernetesVersion, properties.distribution, properties.infrastructure, properties.totalNodeCount, properties.totalCoreCount
| where type =~ 'Microsoft.Kubernetes/connectedClusters'
az graph query -q "Resources | project id, subscriptionId, location, type, properties.agentVersion, properties.kubernetesVersion, properties.distribution, properties.infrastructure, properties.totalNodeCount, properties.totalCoreCount | where type =~ 'Microsoft.Kubernetes/connectedClusters'"

Az összes fluxuskonfigurációt tartalmazó Csatlakozás edClusters és ManagedClusters listázása

A legalább egy fluxConfigurationt tartalmazó fürtök csatlakoztatottCluster- és managedCluster-azonosítóit adja vissza.

resources
| where type =~ 'Microsoft.Kubernetes/connectedClusters' or type =~ 'Microsoft.ContainerService/managedClusters' | extend clusterId = tolower(id) | project clusterId
| join
( kubernetesconfigurationresources
| where type == 'microsoft.kubernetesconfiguration/fluxconfigurations'
| parse tolower(id) with clusterId '/providers/microsoft.kubernetesconfiguration/fluxconfigurations' *
| project clusterId
) on clusterId
| project clusterId
az graph query -q "resources | where type =~ 'Microsoft.Kubernetes/connectedClusters' or type =~ 'Microsoft.ContainerService/managedClusters' | extend clusterId = tolower(id) | project clusterId | join ( kubernetesconfigurationresources | where type == 'microsoft.kubernetesconfiguration/fluxconfigurations' | parse tolower(id) with clusterId '/providers/microsoft.kubernetesconfiguration/fluxconfigurations' * | project clusterId ) on clusterId | project clusterId"

Az összes nem megfelelő állapotú fluxuskonfiguráció listázása

Azon konfigurációk fluxConfiguration azonosítóit adja vissza, amelyek nem szinkronizálják a fürt erőforrásait.

kubernetesconfigurationresources
| where type == 'microsoft.kubernetesconfiguration/fluxconfigurations'
| where properties.complianceState == 'Non-Compliant'
| project id
az graph query -q "kubernetesconfigurationresources | where type == 'microsoft.kubernetesconfiguration/fluxconfigurations' | where properties.complianceState == 'Non-Compliant' | project id"

Következő lépések

  • További információ a lekérdezés nyelvéről.
  • További információ az erőforrások felfedezéséről.
  • Tekintse meg az alapnyelvi lekérdezések mintáit.
  • Speciális nyelvi lekérdezések mintáinak megtekintése.