microsoft / microsoft/finops-toolkit

Support cross-tenant ARG queries for hubs recommendations

Open
#2,004 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Tool: FinOps hubs Type: Feature 💎
Dominant language
PowerShell
Stars
603
Forks
248
Avg merge
7d 11h
Merged PRs (30d)
11

Description

Summary

FinOps hubs recommendations currently query Azure Resource Graph at tenant scope using the Data Factory managed identity. While Azure Lighthouse delegated resources are automatically included in tenant-scope queries, there is no support for explicit cross-tenant queries to tenants not configured via Lighthouse.

Current behavior

  • Queries run at tenant scope (no subscriptions or managementGroups in the ARG API request body)
  • The Data Factory managed identity authenticates against the home tenant only
  • Azure Lighthouse delegated resources are automatically included (no changes needed)
  • Cross-tenant queries to non-Lighthouse tenants are not supported

Desired behavior

Support querying resources across multiple tenants that are not configured via Azure Lighthouse, enabling multi-tenant FinOps scenarios such as MSPs managing resources across customer tenants.

Technical considerations

  • The ARG REST API does not have a tenantId parameter; tenant scope is determined by the authentication token
  • Azure Resource Manager supports x-ms-authorization-auxiliary header with up to 3 auxiliary bearer tokens for cross-tenant access
  • Supporting non-Lighthouse cross-tenant queries would require:
    • A multi-tenant app registration consented in each target tenant
    • Credentials stored in Key Vault
    • Token acquisition via Web activities in the ADF pipeline
    • Pipeline refactoring to loop over external tenants or pass auxiliary tokens
  • Alternative approach: ForEach loop over external tenants, acquiring a token per tenant and running queries independently (avoids the 3-tenant limit of auxiliary tokens)

Workaround

Configure Azure Lighthouse delegations from target tenants. Lighthouse-delegated resources automatically appear in tenant-scope ARG queries without any code changes.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Azure Data Factory pipeline activities that acquire credentials and issue Azure Resource Graph REST API queries. Review the Key Vault, Web activity, auxiliary-token, and external-tenant ForEach alternatives described in the issue, including the three-tenant auxiliary-token limit. Done means non-Lighthouse target tenants can be queried through a documented, working pipeline approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
authentication, cloud, data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.