Azure / azure-cli

Azure Command-Line Interface
MIT License
3.92k stars 2.89k forks source link

how to use "az monitor log-analytics query" for resource StorageBlobLogs? #20629

Open MonikaReddy-MSFT opened 2 years ago

MonikaReddy-MSFT commented 2 years ago

Customer has raised an issue -

I noticed that if I want to run a log-analytics query on StorageBlobLogs like

StorageBlobLogs| where TimeGenerated > ago(1d)

in my log analytics workspace I need to use select scope to switch from resource type log analytics workspace either to my resource group or to storage account. This is fine for me if using azure web portal. But how to proceed via azure cli using

az monitor log-analytics query --workspace --analytics-query "StorageBlobLogs| where TimeGenerated > ago(1d)'"

This will always result in an empty result and I have no option to select a scope like in the azure portal. Any hint how to get the same result via az cli like as in azure portal?

https://docs.microsoft.com/en-us/answers/questions/649151/index.html

jiasli commented 2 years ago

@kairu-ms to help with this issue.