
- #Splunk advanced search query examples how to#
- #Splunk advanced search query examples free#
Matches any single character (except a new line).
^ - Match must start at the beginning of the string. The matches regex allows us to define the regex to match, which is ^Contoso(.*)+$. This query looks for virtual machines that match a regular expression Search-AzGraph -Query "Resources | project tags | summarize buildschema(tags)" | project-away subscriptionId, subscriptionId1Īz graph query -q "Resources | project tags | summarize buildschema(tags)" | join (ResourceContainers | where type='microsoft.resources/subscriptions' | project SubName=name, subscriptionId) on subscriptionId | summarize resourceCount=count() by subscriptionId Subscription details from ResourceContainers table, then project-away to remove some of the The following query uses summarize to count resources by subscription, join to combine it with Search-AzGraph -Query "Resources | where type=~ 'pute/virtualmachinescalesets' | where name contains 'contoso' | project subscriptionId, name, location, resourceGroup, Capacity = toint(sku.capacity), Tier = sku.name | order by Capacity desc" | project subscriptionId, name, location, resourceGroup, Capacity = toint(sku.capacity), Tier = sku.nameĪz graph query -q "Resources | where type=~ 'pute/virtualmachinescalesets' | where name contains 'contoso' | project subscriptionId, name, location, resourceGroup, Capacity = toint(sku.capacity), Tier = sku.name | order by Capacity desc" | where type=~ 'pute/virtualmachinescalesets' Finally, the columns are renamed into custom The query uses the toint() function toĬast the capacity to a number so that it can be sorted. Virtual machine size and the capacity of the scale set. This query looks for virtual machine scale set resources and gets various details including the Get virtual machine scale set capacity and size Try this query in Azure Resource Graph Explorer: Search-AzGraph -Query "Resources | distinct type, apiVersion | where isnotnull(apiVersion) | order by type asc" The following query details theĪPI version used for gathering properties on each resource type: ResourcesĪz graph query -q "Resources | distinct type, apiVersion | where isnotnull(apiVersion) | order by type asc" To provide more current or widely used properties in the results. In some cases, the API version used has been overridden GET resource properties during an update. Resource Graph primarily uses the most recent non-preview version of a Resource Provider API to Validate your shell environment of choice. Before running any of the following queries, check that your environment is ready. #Splunk advanced search query examples free#
If you don't have an Azure subscription, create a free accountĪzure CLI (through an extension) and Azure PowerShell (through a module) support Azure Resource
Summarize virtual machine by the power states extended property. Get virtual networks and subnets of network interfaces. Combine results from two queries into a single result. Find storage accounts with a specific tag on the resource group. List all extensions installed on a virtual machine. List virtual machines with their network interface and public IP. List SQL Databases and their elastic pools. List Azure Cosmos DB with specific write locations. Get virtual machine scale set capacity and size.
Show API version for each resource type.
We'll walk through the following advanced queries:
#Splunk advanced search query examples how to#
To understand how to compose requests for the resources you're looking for. If you aren't already familiar with Azure DataĮxplorer, it's recommended to review the basics The first step to understanding queries with Azure Resource Graph is a basic understanding of the