KQL library
Every Log Analytics query from this site in one place. Copy one, paste it into your workspace and adjust the table or time range.
- Free
- Runs in your browser
- No sign-up
Azure web role vs worker role: what they were, and where to move them before March 2027
from the post · 5 Nov 2026
Find what you still have
az graph query -q "resources
| where type =~ 'microsoft.compute/cloudservices'
| project name, resourceGroup, subscriptionId, location" -o table10 November is the biggest end-of-support day of the year: what ends, how to find it, and what to move to
from the post · 29 Oct 2026
.NET 8 and .NET 9
resources
| where type =~ "microsoft.web/sites" or type =~ "microsoft.web/sites/slots"
| mv-expand p = properties.siteProperties.properties
| where tostring(p.name) =~ "LinuxFxVersion"
| extend stack = tostring(p.value)
| where stack matches regex @"(?i)^dotnet(core|-isolated)?\|(8|9)\.0"
| project name, kind, resourceGroup, subscriptionId, stack
| order by stack ascThe PHP flaw that took websites offline worldwide: what AI found, and what to do in Azure today
from the post · 21 Oct 2026
Find every PHP app you run
resources
| where type =~ "microsoft.web/sites" or type =~ "microsoft.web/sites/slots"
| mv-expand p = properties.siteProperties.properties
| where tostring(p.name) =~ "LinuxFxVersion" and tostring(p.value) startswith "PHP|"
| project name, resourceGroup, subscriptionId, stack = tostring(p.value)
| order by stack ascAzure Arc for servers: the complete setup guide
from the post · 17 Oct 2026
Day-two operations
Resources
| where type == 'microsoft.hybridcompute/machines'
| summarize Servers = count() by Status = tostring(properties.status)Day-two operations
AdvisorResources
| where type == 'microsoft.advisor/recommendations'
| where properties.category == 'HighAvailability'
| where properties.shortDescription.solution == 'Upgrade to the latest version of the Azure Connected Machine agent'
| project id, JoinId = toupper(properties.resourceMetadata.resourceId),
machineName = tostring(properties.impactedValue),
agentVersion = tostring(properties.extendedProperties.installedVersion),
expectedVersion = tostring(properties.extendedProperties.latestVersion)
| join kind=leftouter (
Resources
| where type == 'microsoft.hybridcompute/machines'
| project machineId = toupper(id), status = tostring(properties.status)
) on $left.JoinId == $right.machineId
| where status != 'Expired'
| summarize by id, machineName, agentVersion, expectedVersion
| order by tolower(machineName) ascWindows Server 2012 and 2012 R2: the last security update ships tomorrow
from the post · 12 Oct 2026
Find every one you have
DeviceInfo
| where Timestamp > ago(7d)
| where OSPlatform startswith "WindowsServer2012"
| summarize arg_max(Timestamp, OSPlatform, OSBuild, PublicIP) by DeviceName
| order by DeviceName ascFind every one you have
resources
| where type in~ ("microsoft.compute/virtualmachines", "microsoft.hybridcompute/machines")
| extend os = tostring(coalesce(properties.extended.instanceView.osName, properties.osSku, properties.osName))
| where os has "2012"
| project name, type, os, resourceGroup, subscriptionId, locationKey Vault: move from access policies to Azure RBAC
from the post · 12 Aug 2026
Finding vaults still on access policies
// Azure Resource Graph
resources
| where type == "microsoft.keyvault/vaults"
| extend rbac = tobool(properties.enableRbacAuthorization)
| where rbac != true
| project name, resourceGroup, subscriptionIdSix KQL queries for Entra sign-in logs every admin should keep
from the post · 11 Mar 2026
1. Top sign-in failures
SigninLogs
| where TimeGenerated > ago(7d) and ResultType != "0"
| summarize Count = count() by ResultType, ResultDescription
| top 20 by Count2. One user's recent sign-ins
SigninLogs
| where TimeGenerated > ago(3d)
| where UserPrincipalName =~ "jane.doe@contoso.com"
| project TimeGenerated, AppDisplayName, ResultType, ResultDescription,
IPAddress, Location = tostring(LocationDetails.countryOrRegion),
ConditionalAccessStatus
| order by TimeGenerated desc3. Sign-ins blocked by Conditional Access
SigninLogs
| where TimeGenerated > ago(1d) and ConditionalAccessStatus == "failure"
| summarize Count = count() by UserPrincipalName, AppDisplayName
| order by Count desc4. Successful sign-ins from new countries
let known = SigninLogs
| where TimeGenerated between (ago(30d) .. ago(1d)) and ResultType == "0"
| distinct UserPrincipalName, Country = tostring(LocationDetails.countryOrRegion);
SigninLogs
| where TimeGenerated > ago(1d) and ResultType == "0"
| extend Country = tostring(LocationDetails.countryOrRegion)
| join kind=leftanti known on UserPrincipalName, Country
| project TimeGenerated, UserPrincipalName, Country, IPAddress, AppDisplayName5. Password spray pattern
SigninLogs
| where TimeGenerated > ago(1h) and ResultType == "50126"
| summarize Users = dcount(UserPrincipalName) by IPAddress
| where Users > 10
| order by Users desc6. Legacy authentication still in use
SigninLogs
| where TimeGenerated > ago(14d)
| where ClientAppUsed !in ("Browser", "Mobile Apps and Desktop clients")
| summarize Count = count() by ClientAppUsed, UserPrincipalName, AppDisplayName
| order by Count desc7. Non-interactive sign-ins by app
AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| summarize Count = count(), Failures = countif(ResultType != "0") by AppDisplayName
| order by Count desc8. Service principal sign-ins from unexpected IPs
AADServicePrincipalSignInLogs
| where TimeGenerated > ago(7d) and ResultType == "0"
| summarize IPs = make_set(IPAddress, 20), Count = count() by ServicePrincipalName
| where array_length(IPs) > 3
| order by Count descNamed locations: getting IP ranges and countries right in Conditional Access
from the post · 17 Dec 2025
Building a country block safely
SigninLogs
| where TimeGenerated > ago(30d) and ResultType == "0"
| summarize Users = dcount(UserPrincipalName), SignIns = count() by Country = tostring(LocationDetails.countryOrRegion)
| order by SignIns descTurning on Defender CSPM across a landing zone
from the post · 3 Dec 2025
Checking coverage
// Azure Resource Graph: Defender CSPM status per subscription
securityresources
| where type == "microsoft.security/pricings" and name == "CloudPosture"
| project subscriptionId, tier = tostring(properties.pricingTier)
| order by tier ascTest Conditional Access safely with report-only mode and What If
from the post · 26 Nov 2025
Reviewing the impact
SigninLogs
| where TimeGenerated > ago(7d)
| mv-expand ConditionalAccessPolicies
| where ConditionalAccessPolicies.displayName == "Require compliant device"
| where ConditionalAccessPolicies.result == "reportOnlyFailure"
| summarize Failures = count() by UserPrincipalName, AppDisplayName
| order by Failures descBreak-glass accounts done right
from the post · 12 Nov 2025
Monitoring
SigninLogs
| where UserPrincipalName in~ ("bg-admin1@contoso.onmicrosoft.com", "bg-admin2@contoso.onmicrosoft.com")
| project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, ResultType