Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,316 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm trying to list Azure activities in my Log Analytics workspace, and need the subscription name to be displayed.
With my current KQL request:
AzureActivity
| extend subscriptionId = SubscriptionId
| join kind=inner (
arg("").ResourceContainers
| where type == 'microsoft.resources/subscriptions'
| project subscriptionId, subscriptionName = name
) on subscriptionId
Azure responds with the following answer:
Some aspects of the query had errors so the results are not complete If the issue persists, please open a support ticket. Request id: 23323d56-22e4-490c-b15f-3398a513054f
As I currently only have a basic support plan, I'm asking here...
Hi @Julien Allaix There are a few things I would change to make this run, but also to be aware of.
arg("").ResourceContainers
| where type == "microsoft.resources/subscriptions"
| project SubscriptionName = name, SubscriptionId = subscriptionId
AzureActivity
| where TimeGenerated >ago(7d)
arg("").ResourceContainers
| where type == "microsoft.resources/subscriptions"
| project SubscriptionName = name, SubscriptionId = subscriptionId
| join kind=inner (
AzureActivity
| where TimeGenerated >ago(7d)
) on SubscriptionId
| project-away SubscriptionId1
arg("").ResourceContainers
| where type == "microsoft.resources/subscriptions"
| project SubscriptionName = name, SubscriptionId = subscriptionId
| join kind=rightouter (
AzureActivity
| where TimeGenerated >ago(7d)
) on SubscriptionId
| extend SubscriptionId = SubscriptionId1
| project-away SubscriptionId1
| extend SubscriptionName = iff(isempty(SubscriptionName), SubscriptionId, SubscriptionName)
let Subscriptions =
arg("").ResourceContainers
| where type == "microsoft.resources/subscriptions"
| project SubscriptionName = name, SubscriptionId = subscriptionId
;
let Logs =
AzureActivity
| where TimeGenerated >ago(1d)
| summarize arg_max(TimeGenerated, * ) by SubscriptionId
;
Subscriptions
| join kind = rightouter (
Logs
) on SubscriptionId
| extend SubscriptionId = SubscriptionId1
| project-away SubscriptionId1
| extend SubscriptionName = iff(isempty(SubscriptionName), SubscriptionId, SubscriptionName)
Hope this helps
Alistair