microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.
Apache License 2.0
510 stars 97 forks source link

Getting an error when trying to get an agent node pool node count #79

Closed mykolaichuk closed 1 year ago

mykolaichuk commented 1 year ago

I have the following query which fails when I try to get node count. Without _NodeCount = propertiesagentPoolProfiles.count query will work.

Resources
| where type == 'microsoft.containerservice/managedclusters'
| mv-expand properties.agentPoolProfiles
| where properties_agentPoolProfiles.name == "pool01"
| join kind=inner (
    resourcecontainers
    | where type == 'microsoft.resources/subscriptions'
    | project subscriptionId, subscriptionName = name)
    on subscriptionId
| where subscriptionName == 'Staging'
| project subscriptionName, name, location, VMSize = properties_agentPoolProfiles.vmSize, NodePoolName = properties_agentPoolProfiles.name, NodeCount = properties_agentPoolProfiles.count
| sort by name asc

Appreciate any help on this!

sloutsky commented 1 year ago

Some keywords (e.g. count) may require escaping

Try:

Resources
| where type == 'microsoft.containerservice/managedclusters'
| mv-expand properties.agentPoolProfiles
| where properties_agentPoolProfiles.name == "pool01"
| join kind=inner (
    resourcecontainers
    | where type == 'microsoft.resources/subscriptions'
    | project subscriptionId, subscriptionName = name)
    on subscriptionId
| where subscriptionName == 'Staging'
| project subscriptionName, name, location, VMSize = properties_agentPoolProfiles.vmSize, NodePoolName = properties_agentPoolProfiles.name, NodeCount = properties_agentPoolProfiles.['count']
| sort by name asc
mykolaichuk commented 1 year ago

Some keywords (e.g. count) may require escaping

Try:

Resources
| where type == 'microsoft.containerservice/managedclusters'
| mv-expand properties.agentPoolProfiles
| where properties_agentPoolProfiles.name == "pool01"
| join kind=inner (
    resourcecontainers
    | where type == 'microsoft.resources/subscriptions'
    | project subscriptionId, subscriptionName = name)
    on subscriptionId
| where subscriptionName == 'Staging'
| project subscriptionName, name, location, VMSize = properties_agentPoolProfiles.vmSize, NodePoolName = properties_agentPoolProfiles.name, NodeCount = properties_agentPoolProfiles.['count']
| sort by name asc

thanks, it worked!