Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
383 stars 1.24k forks source link

az monitor log-analytics query is very picky about kusto queries #5147

Open arkady69 opened 2 years ago

arkady69 commented 2 years ago

$query = 'AzureDiagnostics | where action_s == "Blocked" | count'

$w = 'valid--id'

Invoke-AzOperationalInsightsQuery -WorkspaceId $w -Query $query -ErrorAction Stop -Timespan (New-TimeSpan -Hours 2)| Select-Object -ExpandProperty Results --> produces Count

123

'az monitor log-analytics query -w $w --analytics-query $query -t PT3H ' produces -> BadArgumentError: The request had some invalid properties

its a valid kusto query. the powershell cmdlet produces a result. az cli breaks.

Why?

yonzhan commented 2 years ago

monitor