← Back to SOC feed Coverage →

Azure CloudShell Usage

kql MEDIUM Azure-Sentinel
T1059
AzureActivity
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-04-23T09:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use Azure CloudShell to execute commands and exfiltrate data undetected by leveraging cloud-native tools. SOC teams should proactively hunt for this behavior to identify potential command and control activities or data exfiltration attempts in their Azure Sentinel environment.

KQL Query


AzureActivity
   | where ActivityStatusValue =~ "Success"
   | where ResourceGroup has "cloud-shell-storage"
   | where OperationNameValue =~ "Microsoft.Storage/storageAccounts/listKeys/action"
   // Change the timekey scope below to get activity for a longer window 
   | summarize by Caller, timekey= bin(TimeGenerated, 1h)
   | join (AzureActivity | where TimeGenerated >= ago(1d)
   | where OperationNameValue !~ "Microsoft.Storage/storageAccounts/listKeys/action"
   | where isnotempty(OperationNameValue)
    // Change the timekey scope below to get activity for a longer window 
   | summarize make_set(OperationNameValue) by Caller, timekey=bin(TimeGenerated, 1h)) on Caller, timekey
   | extend timestamp = timekey, AccountCustomEntity = Caller

Analytic Rule Definition

id: 42831fb3-f61d-41e9-95d9-f08797479a0e
name: Azure CloudShell Usage
description: |
  'This query look for users starting an Azure CloudShell session and summarizes the Azure Activity from that
  user account during that timeframe (by default 1 hour). This can be used to help identify abuse of the CloudShell
  to modify Azure resources.'
requiredDataConnectors:
  - connectorId: AzureActiveDirectory
    dataTypes:
      - AuditLogs
tactics:
  - Execution
relevantTechniques:
  - T1059
query: |

   AzureActivity
      | where ActivityStatusValue =~ "Success"
      | where ResourceGroup has "cloud-shell-storage"
      | where OperationNameValue =~ "Microsoft.Storage/storageAccounts/listKeys/action"
      // Change the timekey scope below to get activity for a longer window 
      | summarize by Caller, timekey= bin(TimeGenerated, 1h)
      | join (AzureActivity | where TimeGenerated >= ago(1d)
      | where OperationNameValue !~ "Microsoft.Storage/storageAccounts/listKeys/action"
      | where isnotempty(OperationNameValue)
       // Change the timekey scope below to get activity for a longer window 
      | summarize make_set(OperationNameValue) by Caller, timekey=bin(TimeGenerated, 1h)) on Caller, timekey
      | extend timestamp = timekey, AccountCustomEntity = Caller

entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: AccountCustomEntity
version: 1.0.0
metadata:
    source:
        kind: Community
    author:
        name: Pete Bryan
    support:
        tier: Community
    categories:
        domains: [ "Security - Other" ]

Required Data Sources

Sentinel TableNotes
AzureActivityEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/AzureActivity/Azure-CloudShell-Usage.yaml