Chapter 3 of 6 · Before you start

AI cost allocation, budgets, and gateway token chargeback

Optional module · Draft 4.5 hours

Chapter 3 of 6

Confirm these prerequisites:

  • The approved Azure subscription is recorded as a full Azure subscription resource ID.
  • Session 06 has a working APIM route, and the gateway owner controls the policy source.
  • Session 11 has the approved Application Insights or Log Analytics telemetry boundary and action group.
  • The APIM instance is integrated with Application Insights and custom metrics with dimensions are enabled.
  • API Management diagnostic settings can support the chargeback query. Response-body logging can capture sensitive data, so enable it only under the approved telemetry boundary.
  • Finance has approved the cost-center taxonomy, APIM product mapping, monthly token quotas, budget filters, token rates, reconciliation cadence, and restore reference.
  • The deployment operator has time-bound access to assign policy, deploy subscription budgets, and preview subscription-scope Bicep.

Implementation files#

TypeFileConsumer
Deploymentartifacts/policy/tag-allocation.bicepThe subscription policy deployment pipeline
Deploymentartifacts/policy/tag-allocation.bicepparamThe subscription policy deployment pipeline
Deploymentartifacts/cost/ai-budget-with-filters.bicepThe subscription budget deployment pipeline and cost owner
Deploymentartifacts/cost/ai-budget-with-filters.bicepparamThe subscription budget deployment pipeline
Runtimeartifacts/apim/token-chargeback-policy.xmlThe API Management gateway policy repository
Runtimeartifacts/queries/token-chargeback.kqlThe FinOps analyst and Application Insights or Log Analytics operator
Recordartifacts/finance/chargeback-decisions.jsonThe cost owner, gateway owner, and module preflight scripts
Recordartifacts/finance/token-rate-table.jsonThe FinOps analyst and chargeback reporting pipeline

Resolve every __REQUIRED_*__ value in the approved private implementation path before deployment. Keep subscription IDs, resource IDs, tenant IDs, prompts, responses, tokens, customer names, and raw usage exports out of this repository.

Optional module

AI cost allocation, budgets, and gateway token chargeback slide deck