Skip to content

feat: add costing-entra-appid sample with Azure Workbook dashboard#145

Open
ncheruvu-MSFT wants to merge 24 commits intomainfrom
feature/costing-entra-appid
Open

feat: add costing-entra-appid sample with Azure Workbook dashboard#145
ncheruvu-MSFT wants to merge 24 commits intomainfrom
feature/costing-entra-appid

Conversation

@ncheruvu-MSFT
Copy link
Contributor

Summary

Adds a new sample costing-entra-appid that demonstrates APIM cost attribution by Entra ID caller (app registration).

What's included

  • caller-id-policy.xml - APIM policy that extracts \�ppid\ from JWT tokens and emits custom metrics with caller identity
  • main.bicep - Deploys Log Analytics, Application Insights, APIM diagnostic settings, and an Azure Workbook dashboard
  • create.ipynb - End-to-end notebook: deploy infrastructure, create Entra test apps, generate traffic, verify data, view reports
  • README.md - Full documentation with architecture, prerequisites, and workbook details

Azure Workbook features

  • 3 foldable sections: Usage by Caller, Cost Allocation, Request Trend
  • Name resolution: JSON parameter maps app IDs to friendly names
  • Accessibility: borders, readable labels, no-data messages, side-by-side layout
  • Parameters: TimeRange selector, BaseCost (USD), AppIdNames (JSON mapping)

Testing

  • Deployed and verified on Basicv2 APIM instance (index 4)
  • Simulated 4 callers + 2 real Entra app registrations
  • All 6 caller IDs visible in workbook queries
  • Infrastructure deleted after testing

ncheruvu-MSFT and others added 4 commits February 7, 2026 12:18
- Add costing sample with cost allocation workbook, cost exports, and budget alerts

- Add screenshots for cost reports and dashboard views

- Remove manual fallback steps (managed identity handles export auth)

- Update README with screenshot gallery

- Update shared azure_resources and template notebook
- APIM cost attribution by Entra ID caller (app registration)
- Custom metric emission via caller-id-policy.xml
- Azure Workbook with foldable sections, name resolution, accessibility
- Notebook: full end-to-end deploy, Entra test apps, traffic, verification
- KQL queries for usage, cost allocation, and request trends
@github-actions
Copy link

github-actions bot commented Feb 20, 2026

🐍 Python 3.14 Results

Metric Status Value
Ruff 2 issue(s)
Unit Tests success
Code Coverage 📊 100%

Full Workflow Logs

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

Python 3.14 Detailed Test Results

1 562 tests  ±0   1 562 ✅ ±0   15s ⏱️ -3s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 96712b6. ± Comparison against base commit 6d363bc.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

🐍 Python 3.12 Results

Metric Status Value
Ruff 2 issue(s)
Unit Tests success
Code Coverage 📊 100%

Full Workflow Logs

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

🐍 Python 3.13 Results

Metric Status Value
Ruff 2 issue(s)
Unit Tests success
Code Coverage 📊 100%

Full Workflow Logs

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

Python 3.12 Detailed Test Results

1 562 tests  ±0   1 562 ✅ ±0   18s ⏱️ ±0s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 96712b6. ± Comparison against base commit 6d363bc.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

Python 3.13 Detailed Test Results

1 562 tests  ±0   1 562 ✅ ±0   17s ⏱️ -1s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 96712b6. ± Comparison against base commit 6d363bc.

♻️ This comment has been updated with latest results.

simonkurtz-MSFT and others added 12 commits February 20, 2026 11:11
…atterns

- Replace ARM template with Bicep using shared modules (diagnostics, api, appinsights, workspaces)
- Externalize KQL queries to .kql files (verify-metric-ingestion, budget-alert-threshold)
- Replace caller-id-policy.xml with emit_metric_caller_id.xml (emit-metric policy)
- Add Azure Monitor Workbook (workbook.json) with cost attribution dashboards
- Rewrite create.ipynb following _TEMPLATE pattern with NotebookHelper/deploy_sample()
- Rewrite README.md matching costing sample section order and formatting
- Remove old screenshots (will be re-added once sample is deployed)
- Fix emit_metric_caller_id.xml: add curly braces for APIM Razor parser
- Fix main.bicep: reference infrastructure's existing App Insights/Log Analytics
  instead of deploying separate instances (emit-metric sends to service-level AI)
- Fix create.ipynb: correct App Insights query endpoint and workbook portal link
- Fix budget-alert-threshold.kql: use 'timestamp' instead of 'TimeGenerated' for
  customMetrics table
@ncheruvu-MSFT ncheruvu-MSFT requested a review from san360 February 23, 2026 16:03
@simonkurtz-MSFT simonkurtz-MSFT added enhancement New feature or request scenario An APIM Sample scenario labels Feb 23, 2026
@simonkurtz-MSFT simonkurtz-MSFT self-assigned this Feb 26, 2026
@simonkurtz-MSFT
Copy link
Member

Hi @ncheruvu-MSFT & @san360, I suspect there's a lot of redundancy here to what's in the costing sample, Can you bring this content here in as a new API endpoint into costing? They relate in purpose and different endpoints as part of the same sample are a good way to keep code sprawl down and maintenance low.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scenario An APIM Sample scenario

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants