Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e230be1
feat(hubs): add Azure Resource Manager ingestion
MSBrett Aug 24, 2026
3f94f79
Merge remote-tracking branch 'origin/dev' into features/finops-hubs-a…
MSBrett Aug 24, 2026
c5f116e
feat(dashboard): add AI and emerging workloads view
MSBrett Aug 24, 2026
8ddd21d
feat(hubs): collect availability zone and SKU restriction supply data
MSBrett Aug 24, 2026
e5ed70f
feat(dashboard): add the FinOps hub capacity dashboard canvas
MSBrett Aug 24, 2026
c05fc7c
chore: ignore local knowledge-graph tool output
MSBrett Aug 24, 2026
50d51be
Merge branch 'features/psychic-fiesta' into features/finops-hubs-arm-app
MSBrett Aug 24, 2026
bdfeeac
feat(dashboard): add navigable Compute capacity details
MSBrett Aug 24, 2026
e74b6ee
fix(hubs): secure ARM paging and preserve scope identity
MSBrett Aug 24, 2026
3746816
feat(hubs): expand quota ingestion
MSBrett Aug 26, 2026
d50b2b2
fix(hubs): complete ARM failure handling
MSBrett Aug 26, 2026
ae6d96d
fix(hubs): harden ARM query orchestration
MSBrett Aug 29, 2026
fba96ff
Revert "fix(hubs): harden ARM query orchestration"
MSBrett Aug 29, 2026
ffb9615
fix(hubs): restore ingestion and quota contracts
MSBrett Aug 29, 2026
1e9c36a
chore: ignore local knowledge-graph tool artifacts
MSBrett Aug 30, 2026
de65482
feat(finops-hub): harden ingestion and expand dashboard
MSBrett Aug 30, 2026
6205598
Merge remote-tracking branch 'origin/dev' into features/finops-hubs-a…
MSBrett Aug 30, 2026
246ae4b
fix(dashboard): remove fabricated MACC query
MSBrett Aug 31, 2026
dbb13f9
chore(hubs): update dashboard extension, quota catalog queries, and g…
MSBrett Aug 31, 2026
aa21567
fix(hubs): remediate PR review findings for ARM ingestion
MSBrett Sep 1, 2026
a7d697c
feat(dashboard): add Azure AI capacity matrix view
MSBrett Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ env/
# AI
.claude/settings.local.json
.claude/scheduled_tasks.lock
.copilot-tracking/

# Internal planning docs
/TODO.md
Expand Down
376 changes: 359 additions & 17 deletions src/powershell/Tests/Unit/HubsIngestionQueries.Tests.ps1

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion src/queries/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **Note:** Refer to the [FinOps hub database documentation](./finops-hub-database-guide.md) for table and column definitions.

This catalog contains 37 scenario-specific FinOps Hub KQL queries used by the FinOps Toolkit agents and the Azure SRE Agent recipe.
This catalog contains 47 scenario-specific FinOps hub KQL queries used by the FinOps Toolkit agents and the Azure SRE Agent recipe.
Comment thread
MSBrett marked this conversation as resolved.
Outdated

> **Tip:** Prefer the narrowest scenario-specific query that answers the question. Use [`costs-enriched-base`](./catalog/costs-enriched-base.kql) when you need an enriched row-level baseline for scoped custom analysis or repeated drill-downs.

Expand Down Expand Up @@ -33,6 +33,16 @@ This catalog contains 37 scenario-specific FinOps Hub KQL queries used by the Fi
| List top commitment (RI/SP) transactions | [top-commitment-transactions](./catalog/top-commitment-transactions.kql) | Identify the largest reservation or savings plan purchases and their impact. | Set `N` parameter (default: 10) for result count; set `startDate`/`endDate` to analyze specific purchase periods. |
| List top other (non-commitment, non-usage) transactions | [top-other-transactions](./catalog/top-other-transactions.kql) | Analyze large purchases not covered by RI/SP (e.g., support, marketplace, etc.). | Set `N` parameter (default: 10) for result count; set `startDate`/`endDate` to analyze non-usage spend. |
| Analyze reservation recommendations and break-even points | [reservation-recommendation-breakdown](./catalog/reservation-recommendation-breakdown.kql) | Review Microsoft recommendations for new reservations and their projected savings. | Run without parameters for all recommendations; filter by service or region for targeted optimization. |
| Analyze Savings Plan recommendations | [savings-plan-recommendation-breakdown](./catalog/savings-plan-recommendation-breakdown.kql) | Review Microsoft Savings Plan recommendations for all supported benefit types and terms. | Run without parameters to include compute and database recommendations for one-year and three-year terms. |
| Review current quota usage | [quota-current-usage](./catalog/quota-current-usage.kql) | Review the latest quota and capacity observations across subscriptions and regions. | Run without parameters; filter by subscription, region, resource type, or quota name for targeted analysis. |
| Identify quota headroom | [quota-headroom](./catalog/quota-headroom.kql) | Calculate remaining headroom and usage percentage for quota records with nonnegative limits. | Run without parameters; filter on `PercentUsed` or `Headroom` to prioritize capacity reviews. |
| Review App Service quota usage | [quota-app-service-usage](./catalog/quota-app-service-usage.kql) | Review the latest App Service quota usage for each subscription and region. | Run without parameters; filter by subscription, region, or quota name for targeted analysis. |
| Review Azure AI services quota usage | [quota-cognitive-services-usage](./catalog/quota-cognitive-services-usage.kql) | Review the latest Azure AI services quota usage for each subscription and region. | Run without parameters; filter by subscription, region, or quota name for targeted analysis. |
| Review capacity reservation inventory | [quota-capacity-reservations](./catalog/quota-capacity-reservations.kql) | Review the latest capacity reservation group inventory for each subscription. | Run without parameters; do not calculate quota headroom because inventory rows can have empty limits. |
| Review compute quota usage | [quota-compute-usage](./catalog/quota-compute-usage.kql) | Review the latest compute quota usage for each subscription and region. | Run without parameters; filter by subscription, region, or quota name for targeted analysis. |
| Review Premium SSD v2 disk inventory | [quota-premium-ssd-v2-disks](./catalog/quota-premium-ssd-v2-disks.kql) | Review the latest Premium SSD v2 disk inventory for each subscription. | Run without parameters; `currentValue` contains disk size in GiB and `limit` can be empty. |
| Review SQL subscription quota usage | [quota-sql-subscription-usage](./catalog/quota-sql-subscription-usage.kql) | Review the latest Azure SQL quota usage for each subscription and region. | Run without parameters; filter by subscription, region, or quota name for targeted analysis. |
| Review Storage quota usage | [quota-storage-usage](./catalog/quota-storage-usage.kql) | Review the latest Storage quota usage for each subscription and region. | Run without parameters; filter by subscription, region, or quota name for targeted analysis. |
| Measure % of cost on resources with no tags (KPI: Untagged Costs) | [percentage-untagged-costs](./catalog/percentage-untagged-costs.kql) | FinOps Foundation KPI quantifying cost from resources that carry zero tags. | Set `startDate`/`endDate` for the KPI window; output column `UntaggedPercent` is ready for dashboards and SLO tracking. |
| Measure % of cost on resources lacking required allocation evidence (KPI: Unallocated Costs) | [percentage-unallocated-costs](./catalog/percentage-unallocated-costs.kql) | FinOps Foundation KPI quantifying cost that cannot be allocated due to missing rule, cost center, or ownership-tag evidence. | Edit `allocationEvidenceTagKeys` to your allocation policy; pair with `allocation-accuracy-index` for the complement view. |
| Measure Allocation Accuracy Index (AAI) | [allocation-accuracy-index](./catalog/allocation-accuracy-index.kql) | Directly attributed effective cost expressed as a 0-100 percentage β€” FinOps Foundation KPI. | Edit `allocationEvidenceTagKeys` to your allocation policy; use the same evidence set as `percentage-unallocated-costs` for a comparable view. |
Expand Down
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-app-service-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: App Service quota usage
// DESCRIPTION: Rehydrates the latest App Service quota usage records for each subscription and region.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Web/locations/usages
//
// SOURCE: Quota()
//

Quota()
| where x_SourceType =~ 'AppServiceUsage'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
37 changes: 37 additions & 0 deletions src/queries/catalog/quota-capacity-reservations.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Capacity reservations
// DESCRIPTION: Rehydrates the latest capacity reservation group inventory for each subscription.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Compute/capacityReservationGroups
//
// SOURCE: Quota()
//
// NOTES:
// - Capacity reservation groups are inventory observations, so usage, limit, and unit may be empty.
//

Quota()
| where x_SourceType =~ 'CapacityReservation'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-cognitive-services-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Azure AI services quota usage
// DESCRIPTION: Rehydrates the latest Azure AI services quota usage records for each subscription and region.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.CognitiveServices/locations/usages
//
// SOURCE: Quota()
//

Quota()
| where x_SourceType =~ 'CognitiveServicesUsage'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-compute-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Compute quota usage
// DESCRIPTION: Rehydrates the latest compute quota usage records for each subscription and region.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Compute/locations/usages
//
// SOURCE: Quota()
//

Quota()
| where x_SourceType =~ 'ComputeUsage'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
30 changes: 30 additions & 0 deletions src/queries/catalog/quota-current-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Current quota usage
// DESCRIPTION: Shows the latest quota and capacity observations across subscriptions and regions.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// SOURCE: Quota()
//

Quota()
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceType asc, ResourceName asc
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-headroom.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Quota headroom
// DESCRIPTION: Calculates remaining headroom and usage percentage for quota records with nonnegative limits.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// SOURCE: Quota()
//

Quota()
| summarize arg_max(x_IngestionTime, *) by ResourceId
| extend
Headroom = iff(limit >= 0, limit - currentValue, real(null)),
PercentUsed = iff(limit > 0, round(100.0 * currentValue / limit, 1), real(null))
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
Headroom,
PercentUsed,
unit,
x_SourceType,
x_IngestionTime
| order by PercentUsed desc nulls last
37 changes: 37 additions & 0 deletions src/queries/catalog/quota-premium-ssd-v2-disks.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Premium SSD v2 disks
// DESCRIPTION: Rehydrates the latest Premium SSD v2 disk inventory for each subscription.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Compute/disks
//
// SOURCE: Quota()
//
// NOTES:
// - Premium SSD v2 disks are inventory observations. currentValue contains disk size in GiB, and limit may be empty.
//

Quota()
| where x_SourceType =~ 'PremiumSSDv2Disk'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-sql-subscription-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: SQL subscription quota usage
// DESCRIPTION: Rehydrates the latest Azure SQL quota usage records for each subscription and region.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Sql/locations/usages
//
// SOURCE: Quota()
//

Quota()
| where x_SourceType =~ 'SqlSubscriptionUsage'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
34 changes: 34 additions & 0 deletions src/queries/catalog/quota-storage-usage.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Storage quota usage
// DESCRIPTION: Rehydrates the latest Storage quota usage records for each subscription and region.
// CATEGORY: Governance
// FEATURE: Quota
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.Storage/locations/usages
//
// SOURCE: Quota()
//

Quota()
| where x_SourceType =~ 'StorageUsage'
| summarize arg_max(x_IngestionTime, *) by ResourceId
| project
ProviderName,
ResourceId,
ResourceName,
ResourceType,
SubAccountId,
displayName,
location,
currentValue,
limit,
unit,
x_QuotaDetails,
x_SourceType,
x_SourceVersion,
x_IngestionTime
| order by SubAccountId asc, location asc, ResourceName asc
44 changes: 44 additions & 0 deletions src/queries/catalog/savings-plan-recommendation-breakdown.kql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// NAME: Savings plan recommendation breakdown
// DESCRIPTION: Summarizes Savings Plan recommendations for all supported benefit types and terms.
// CATEGORY: Optimization
// FEATURE: Recommendations
// REGION: All
// TECH: KQL
//
// RESOURCE TYPES: Microsoft.CostManagement/benefitRecommendations
//
// SOURCE: Recommendations()
//
// NOTES:
// - Savings Plan recommendations include both compute and database benefits.
// - Costs and savings use the billing currency returned by Cost Management.
// - Savings rates are rounded to one decimal place for readability.
//

Recommendations()
| where x_SourceProvider =~ "Microsoft" and x_SourceType =~ "SavingsPlan"
| extend
BenefitType = replace_regex(tostring(x_RecommendationDetails.x_ArmSkuName), @"_Savings_Plan$", ""),
ArmSkuName = tostring(x_RecommendationDetails.x_ArmSkuName),
Term = tostring(x_RecommendationDetails.x_Term),
LookBackPeriod = tostring(x_RecommendationDetails.x_LookBackPeriod),
Scope = tostring(x_RecommendationDetails.x_Scope),
CurrencyCode = tostring(x_RecommendationDetails.x_CurrencyCode)
| summarize arg_max(x_RecommendationDate, *) by BenefitType, ArmSkuName, Term, LookBackPeriod, Scope
| project
BenefitType,
ArmSkuName,
Term,
LookBackPeriod,
Scope,
CurrencyCode,
Comment thread
MSBrett marked this conversation as resolved.
Outdated
CostWithoutBenefit = x_EffectiveCostBefore,
CostWithBenefit = x_EffectiveCostAfter,
EstimatedSavings = x_EffectiveCostSavings,
SavingsRate = round(100.0 * x_EffectiveCostSavings / x_EffectiveCostBefore, 1),
RecommendationDate = x_RecommendationDate,
RecommendationId = x_RecommendationId
| order by EstimatedSavings desc
Loading
Loading