Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ Create exports for each scope you want to monitor:
| Resource Group | `subscriptions/{subscription-id}/resourceGroups/{rg-name}` |

**Supported Datasets:**
- Cost and usage details (FOCUS) - `1.0`, `1.0r2`

- Cost and usage details (FOCUS) - `1.0`, `1.0r2`, `1.2`, `1.2-preview` (Cost Management export versions). Hubs can also ingest `1.3` and `1.4-preview` if Cost Management ships those exports.
- Price sheet - `2023-05-01` (required for missing prices)
- Reservation details - `2023-03-01`
- Reservation recommendations - `2023-05-01` (required for Rate optimization report)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ All KQL queries are located in `references/queries/`:

**Database Rules:**
- Always use "Hub" database, NEVER "Ingestion"
- Function-based access: `Costs()`, `Prices()`, `Recommendations()`, `Transactions()`
- Function-based access: `Costs()`, `Prices()`, `CommitmentDiscountUsage()`, `ContractCommitment()`, `Recommendations()`, `Transactions()`
- The unversioned functions (`Costs()`, etc.) return the latest GA FOCUS schema. Use versioned functions (`Costs_v1_0()`, `Costs_v1_2()`, `Costs_v1_3()`) to pin to a specific schema. `Costs_v1_4()` is **preview** while FOCUS 1.4 is in working draft and may change.
- FOCUS 1.3 added: `AllocatedMethodId`, `AllocatedMethodDetails`, `AllocatedResourceId`, `AllocatedResourceName`, `AllocatedTags` (data-generator split cost allocation), `ContractApplied` (per-row contract commitment application), `ServiceProviderName` and `HostProviderName` (replacing deprecated `ProviderName` / `PublisherName`). FOCUS 1.4 removes `ProviderName` and `PublisherName` entirely.
- The `ContractCommitment()` function (FOCUS 1.3+) returns provider-confirmed contract commitment metadata — the dataset feeding `ContractApplied` JSON arrays on each cost row.

---

Expand Down
13 changes: 12 additions & 1 deletion src/templates/claude-plugin/agents/ftk-database-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You are a FinOps Toolkit database specialist with deep expertise in the FinOps h

## Database Architecture

The FinOps hubs database exposes four main analytic functions:
The FinOps hubs database exposes six main analytic functions. The unversioned forms below return the latest GA FOCUS schema; pin to a specific schema with the versioned variants (`Costs_v1_0()`, `Costs_v1_2()`, `Costs_v1_3()`). `Costs_v1_4()` is **preview** while FOCUS 1.4 is in working draft and may change.

### Costs()

Expand All @@ -28,6 +28,9 @@ The primary table for cost and usage analytics. Aligned with the FOCUS specifica
| ChargeCategory | string | Category of the charge (Usage, Purchase) |
| PricingCategory | string | Category of pricing (Standard, Spot, Committed) |
| CommitmentDiscountStatus | string | Status of commitment discount (Used, Unused) |
| ContractApplied | dynamic | (FOCUS 1.3+) JSON array of contract commitments applied to this row |
| ServiceProviderName | string | (FOCUS 1.3+) Provider that made the resource available; replaces deprecated `ProviderName` (removed in 1.4) |
| HostProviderName | string | (FOCUS 1.3+) Underlying infrastructure provider; replaces deprecated `PublisherName` (removed in 1.4) |
| ResourceId | string | Unique identifier for the resource |
| ResourceName | string | Name of the resource |
| ResourceType | string | Type of resource |
Expand All @@ -41,6 +44,14 @@ The primary table for cost and usage analytics. Aligned with the FOCUS specifica

Price sheets with list, contracted, and effective pricing. Key columns include `SkuId`, `SkuPriceId`, `ListUnitPrice`, `ContractedUnitPrice`, `x_EffectiveUnitPrice`, `PricingUnit`, `x_SkuMeterCategory`, `x_SkuMeterName`, `x_SkuRegion`, `x_SkuTerm`, `x_EffectivePeriodStart`, `x_EffectivePeriodEnd`.

### CommitmentDiscountUsage()

Reservation and savings plan utilization, joining commitment discounts to the resources that consumed them. Key columns include `ChargePeriodStart`, `ChargePeriodEnd`, `CommitmentDiscountId`, `CommitmentDiscountQuantity`, `CommitmentDiscountUnit`, `ConsumedQuantity`, `ResourceId`, `ServiceName`, `x_CommitmentDiscountCommittedCount`, `x_CommitmentDiscountNormalizedRatio`.

### ContractCommitment()

(FOCUS 1.3+) Provider-confirmed contract commitment metadata — the dataset that feeds `ContractApplied` JSON arrays on each row in `Costs()`. Key columns include `ContractCommitmentId`, `ContractCommitmentCategory` (Spend / Usage), `ContractCommitmentCost`, `ContractCommitmentQuantity`, `ContractCommitmentPeriodStart`, `ContractCommitmentPeriodEnd`, `ContractId`, `BillingCurrency`, `InvoiceIssuerName`. FOCUS 1.4 preview adds payment-term and lifecycle columns (`PaymentModel`, `PaymentInterval`, `LifecycleStatus`, etc.).

### Recommendations()

Reservation and savings plan recommendations from Microsoft. Key columns include `x_EffectiveCostBefore`, `x_EffectiveCostAfter`, `x_EffectiveCostSavings`, `x_RecommendationDate`, `x_RecommendationDetails` (dynamic), `SubAccountId`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Every recommendation must include:
## FinOps domain conventions

- Reference FinOps Framework capabilities by their official names (e.g., "Managing commitment-based discounts", not "reservation management")
- Use FOCUS specification terminology when discussing cost data fields (e.g., BilledCost, EffectiveCost, ListCost, ContractedCost)
- Use FOCUS specification terminology when discussing cost data fields (e.g., BilledCost, EffectiveCost, ListCost, ContractedCost). Prefer FOCUS 1.3+ names where applicable: `ServiceProviderName` (replaces deprecated `ProviderName`, removed in 1.4) and `HostProviderName` (replaces deprecated `PublisherName`, removed in 1.4); `ContractApplied` and the `ContractCommitment()` dataset for contract commitment tracking.
- Reference maturity levels as Crawl/Walk/Run when discussing FinOps practice maturity
- Cite the six FinOps principles when they are relevant to a recommendation
- For Azure-specific guidance, reference the official Microsoft documentation URL
Expand Down
6 changes: 5 additions & 1 deletion src/templates/finops-hub/.build.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_HubInfra.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_RawTables.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_0.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql"
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_3.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_4.kql"
]
},
{
Expand All @@ -43,6 +45,8 @@
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_OpenData.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_0.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_3.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_4.kql",
"modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_Latest.kql"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ module ingestion_VersionedScripts '../../fx/hub-database.bicep' = if (useAzure)
scripts: {
v1_0: loadTextContent('scripts/IngestionSetup_v1_0.kql')
v1_2: loadTextContent('scripts/IngestionSetup_v1_2.kql')
v1_3: loadTextContent('scripts/IngestionSetup_v1_3.kql')
v1_4: loadTextContent('scripts/IngestionSetup_v1_4.kql')
}
continueOnErrors: continueOnErrors
forceUpdateTag: forceUpdateTag
Expand Down Expand Up @@ -413,6 +415,8 @@ module hub_VersionedScripts '../../fx/hub-database.bicep' = if (useAzure) {
scripts: {
v1_0: loadTextContent('scripts/HubSetup_v1_0.kql')
v1_2: loadTextContent('scripts/HubSetup_v1_2.kql')
v1_3: loadTextContent('scripts/HubSetup_v1_3.kql')
v1_4: loadTextContent('scripts/HubSetup_v1_4.kql')
}
continueOnErrors: continueOnErrors
forceUpdateTag: forceUpdateTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,45 @@
with (docstring = 'Gets all commitment discount usage records with the latest supported version of the FOCUS schema.', folder = 'CommitmentDiscountUsage')
CommitmentDiscountUsage()
{
CommitmentDiscountUsage_v1_2()
CommitmentDiscountUsage_v1_3()
}


.create-or-alter function
with (docstring = 'Gets all contract commitments with the latest supported version of the FOCUS schema.', folder = 'ContractCommitment')
ContractCommitment()
{
ContractCommitment_v1_3()
}


.create-or-alter function
with (docstring = 'Gets all cost and usage records with the latest supported version of the FOCUS schema.', folder = 'Costs')
Costs()
{
Costs_v1_2()
Costs_v1_3()
}


.create-or-alter function
with (docstring = 'Gets all prices with the latest supported version of the FOCUS schema.', folder = 'Prices')
Prices()
{
Prices_v1_2()
Prices_v1_3()
}


.create-or-alter function
with (docstring = 'Gets all recommendations with the latest supported version of the FOCUS schema.', folder = 'Recommendations')
Recommendations()
{
Recommendations_v1_2()
Recommendations_v1_3()
}


.create-or-alter function
with (docstring = 'Gets all transactions with the latest supported version of the FOCUS schema.', folder = 'Transactions')
Transactions()
{
Transactions_v1_2()
Transactions_v1_3()
}
Loading