A workspace list arrives with HTTP 200, becomes a spreadsheet, and gets labelled a tenant inventory. The problem surfaces when someone uses it to decide what can be switched off: the identity saw only part of the universe, a page was never collected, or a missing field became zero. The risk is not the file format. It is presenting partial observation as evidence of completeness. Power BI Admin APIs help with discovery; the collector must explain the coverage it actually produced.
Between the call and the spreadsheet there is a distance almost nobody measures: how many pages were traversed, which identity signed the request, and which fields were missing from the response. That distance does not appear in the exported file and vanishes entirely in the first meeting where the number gets quoted. The work described here is about making it visible — not to discredit the count, but to state precisely how far it reaches.
Read the Portuguese version.
What is an inventory through Power BI Admin APIs?
It is an administrative metadata snapshot, accompanied by the query contract and collection ledger. GetGroupsAsAdmin returns workspaces for the organization, whereas ordinary user-accessible lists describe a different universe. Changing a function name without checking authorization does not turn personal discovery into administrative discovery.
Even with the right endpoint, three independent questions remain: which workspaces were observed, which fields arrived for each workspace, and how far the page sequence was traversed. An asset snapshot is not event auditing, an ACL check, or an eligibility decision for moving models to Pro.
The subset depends on the API called, caller permissions, and the availability of data in the Power BI database.
— Microsoft Learn, the AdminDataset definition in GetGroupsAsAdmin.
That qualification belongs in the schema, not in an optional footnote. An absent datasets field is not equivalent to datasets: []. The first means information was not returned; the second is an observed list in that response.
Three gaps need different records. A 200 response does not establish the collector’s authority or the scope it covered. A timeout interrupts paging and leaves the next offset unknown. An attribute that was not requested or returned should stay absent or null, not become an observed count.
Separating the three questions changes the shape of the deliverable. Instead of one table of workspaces, two come out: what was observed, and where the observation stopped. The second is usually short, sometimes three rows, and it is precisely the one that prevents a rushed decision. Whoever receives only the first never discovers that it was incomplete, because a spreadsheet has no way of declaring what never made it in.
The problem it solves
Coverage-aware inventory makes discovery repeatable and challengeable. Instead of delivering only a count, it delivers the endpoint, filters, expansions, UTC timestamp, offsets, failures, and encountered limits. This helps distinguish a real change from a change in the collection method.
Consider the synthetic scenario in this study: the first page contains two workspaces and the second is unavailable. There are two known assets, one unknown page, and an unexamined tail. There is no evidence that the tenant contains only two workspaces. It would also be wrong to discard the two observed assets merely because collection ended partially.
The cost of confusing the two mistakes. Discarding the two observed workspaces because the run finished halfway throws away valid information and forces the whole sweep to be repeated. Treating those two as if they were the entire tenant manufactures a certainty nobody asked for, and that certainty then supports an irreversible decision. Both reactions share one origin: the tool had nowhere to store the state “I do not know”. The coverage ledger exists to give that third state an address, since it is neither success nor failure.
Throttling, downtime, or changes during collection can leave an administrative sweep incomplete. Design the output so that observed records remain useful when collection stops, without treating a missing page as evidence that its assets do not exist.

Acceptance criterion. Before retiring a workspace, match the snapshot to coverage from the same run. If the workspace is missing and collection was partial, leave the decision pending and obtain direct evidence from its owner. Persist to Delta only after checking the identity and destination, without replacing unknowns with zero.
How it works — step by step
- Define the universe. Record
GET /admin/groups, the intended identity, state filter, and expansions. The study usesall; Active, Deleted, and Removing states remain visible. Recording the filter is what lets you compare two runs without mistaking a change in the tenant for a change in the question. - Validate authority outside the lab. Check the delegated or app-only administrative contract and separate sink access. The demonstration neither authenticates nor validates a tenant. Confirm who signs the scheduled run as well, because the interactive test usually executes under a different identity.
- Traverse offsets with a budget. Use
$topand$skip, record every attempt, and stop explicitly on timeout, throttling, or invalid payload. Never turn failure into an empty page. A budget declared in pages and in time keeps the collection from competing for a window with production workloads on the same tenant. - Normalize without inventing fields. Preserve unknown counts as
null, distinguish absent properties from returned lists, and detect repeated or conflicting identifiers. A conflict is not a collector defect: it signals that the universe changed during the sweep and needs reconciliation. - Deliver evidence rather than excessive certainty. Produce snapshot, page, and coverage-summary previews. Enable persistence only after reviewing the Lakehouse, identity, permissions, and retention. Until then the preview is the deliverable, and it already answers the questions the spreadsheet left open.
Pagination: exhausting responses does not freeze the tenant
A documented limit is not a target to be reached. There is a lazy reading of quota numbers that turns a ceiling into a budget: if fifty calls per hour fit, the collector makes fifty. The effect shows up on the day another administrative process needs the same window and finds the tenant saturated by an inventory nobody was expecting. Treat the limits as a shared constraint, size the page to the largest value that still fits inside the timeout, and leave slack for the retry that will always happen.
Documentation requires $top between 1 and 5000 and provides $skip for later results. It also documents 50 requests per hour or 15 per minute, per tenant, and a call timeout after 30 seconds. These limits should guide page size, frequency, and 429 handling; they are not an invitation to make calls until the quota runs out.
The synthetic collector uses $top=2 to make transitions visible. A page smaller than the requested size ends that fixture sequence. The result sets pagination_exhausted=true but retains tenant_complete=false. The API does not promise a transactionally stable snapshot across offsets. Concurrent creation, removal, or changes can require reconciliation in another collection.
If the local budget ends after a full page, the next offset enters the ledger as unknown. When a workspace reappears, the collector deduplicates by identifier. If its content differs, it preserves the first observation and records a conflict. Deduplication removes repetition; it does not prove that no asset slipped between two pages.
Page size also changes the cost of a failure. Large pages reduce the number of calls and increase the volume lost when one of them exceeds the timeout; small pages do the opposite and spend more quota. Choosing between the two is a risk decision, and it deserves to sit recorded next to the result.
Administrative identity is not content identity
The name of the role does not describe what the call can see. In Power BI, “administrator” appears in at least three different contexts — workspace, capacity, and tenant — and only the last comes close to the contract the administrative API requires. The confusion is understandable and expensive: someone with broad rights in their own workspace gets a 200 from a new call and concludes they now see the organization. What changed was the endpoint, not the authority.
For a delegated administrative token, the reference requires a Fabric administrator and Tenant.Read.All or Tenant.ReadWrite.All. The service principal contract differs: read-only administrative API enablement, an approved security group, and none of the Power BI admin-consent-required permissions described in the documentation. App-only access is not solved by copying delegated scopes onto the application.
Administrative metadata access does not grant access to every model’s contents. Detailed table, measure, and expression information depends on scanning settings; obtaining workspace names does not prove complete DAX or mashup coverage. This study changes none of those controls and collects no members, emails, or subscriptions.
Notebook execution identity also deserves attention. Interactive execution uses the current user; a default pipeline context can depend on its last editor; an activity Connection can select an SP or Workspace Identity; a schedule depends on its creator or last updater. Verify each path. An interactive test does not establish scheduled-run authorization.
notebookutils.credentials.getToken('pbi') under SP has limited scopes. It is not universal administrative API authentication. Where additional scopes are required, acquisition must follow an authorized, operation-specific flow such as MSAL, without logging tokens. The PBIClient and fabricClient interfaces shown only by help are not supported APIs for building this lab.
The practical rule is to treat identity as part of the data, not as job configuration. If the snapshot does not say who collected it, the comparison against the previous cut mixes two questions, and the difference between them stops meaning anything about the tenant.
Delta: retain the absence of evidence too
A table that only stores success lies by omission. The envelope exists so that the “unknown page” row carries the same weight as a workspace row. If absence does not fit the schema, it will be dropped at the first normalization and nobody will notice: the result stays well formed, it just stops being true. Modelling the intermediate state before writing the first row is cheaper than discovering, months later, that the entire history was written without it.
The preview uses an envelope with record_type, record_key, snapshot_utc, and payload_json. Workspaces, coverage, and summary occupy distinct records within the same proposed table. The unknown page remains queryable rather than disappearing during normalization.
The optional write cell requires three explicit choices: disable dry-run, enable write_delta, and confirm sink_authorized. The fixed allowlist accepts only editorial_synthetic.demo_admin_inventory; the runtime must confirm the Lakehouse namespace. Authorization includes notebook execution and item/table write rights, not merely obtaining a token. MERGE preserves snapshots by UTC timestamp and provides no distributed exactly-once guarantee.
It is worth separating two authorizations that are routinely treated as one: permission to read administrative metadata and permission to write to the destination. They are granted through different paths, revoked by different people, and should appear separately in the run record.
A Power BI Pro destination does not host notebooks. Automation needs separate approved Fabric capacity, F/trial or Fabric-enabled P where applicable, a reviewed Environment, a Lakehouse, and a budget. PPU alone does not provision that runtime. No Delta write or Fabric execution was performed in this delivery.
Use case: deactivating workspaces before a license renewal
Illustrative scenario. The sequence, timings, and outcomes are not customer measurements.
A platform team has three weeks until renewal and needs to reduce the number of active workspaces. The request arrives as “send me the list of what nobody uses so we can deactivate it”. The sentence treats an administrative collection as proof of non-use. The design below returns the decision to whoever holds authority, with coverage declared.
The scope matters more than the request suggests. “What nobody uses” blends three distinct things: a workspace with no content, a workspace with content and no recent access, and a workspace that simply did not appear in the collection. The first two are usage questions and need telemetry this API does not deliver. The third is a coverage question, and it is the only one the inventory answers on its own. Translating the request into those three groups, before opening any spreadsheet, is the first job of the week.
The three weeks, in the order in which they hurt. In the first one, the collection runs, returns a round count, and everyone is satisfied. Nobody asks how many pages were traversed, because the number looks plausible — and a plausible number is rarely audited.
Midway through the second week, somebody cross-checks the list with the business side and two active workspaces turn up that were never in the file. That is when the right question finally appears: did the collection finish, or did it stop? With no ledger there is no way to answer, and the discussion degenerates into opinions about how trustworthy the tool is.
Still in the second week, with the sweep repeated and the tail declared, the discomfort moves. The list grows, the number of deactivation candidates shrinks, and the deadline stays exactly where it was. It is unpleasant, but it is the first time the decision rests on something verifiable.
The third week brings the part the inventory does not solve: usage evidence. Here the ledger does a second, quieter job, because it can say which workspaces were observed in both cuts and which changed state between them. Without that separation, any disappearance becomes a presumed deletion.
Reference architecture. Four blocks with distinct owners:
- Collection contract. The platform records endpoint, filters, expansions, identity, and
snapshot_utcbefore the first call. It describes the intended universe; it reads no content and deactivates nothing. Writing the contract first is what turns the next run into a comparison rather than a second opinion. - Coverage ledger. An append-only table with
record_key,page,page_status, andsnapshot_utcthat preserves the unexamined tail. It never fills an absence with zero. Append-only is not fussiness: overwriting the coverage row erases exactly the proof that the previous run was partial. - Snapshot reconciler. It compares two cuts by identifier and marks whatever disappeared as pending confirmation. It infers no deletion from an incomplete collection. Pending is a working state, with an owner and a deadline, not a polite synonym for ignored.
- Deactivation committee. It decides with the snapshot, the coverage, and usage evidence obtained outside this inventory. It accepts no row without
snapshot_utcand no open unknown page. It is the only block allowed to say “switch it off”, which is why it has to see the coverage before the count.
Four cases from the same run show why a single list does not work:
| Observed case | Coverage of that row | Diagnosis | Indicated path |
|---|---|---|---|
Workspace in both collections with datasets: [] |
Pages complete | Candidate for review | Take to the committee with usage evidence |
| Workspace only in the first collection | Second stopped early | Incomplete coverage | Recollect before any decision |
datasets field absent from the response |
Page complete | Information not returned | Keep null and request explicit expansion |
| Repeated identifier with diverging content | Pages complete | Universe conflict | Preserve the first observation and reconcile |
The four rows describe the same tenant, in the same week, through the same endpoint. Only the first comes close to a deactivation. The second is collection work, the third is contract work, and the fourth is reconciliation work — none of them is a licensing decision. A request that started as “send me the list” ends, in most cases, as three technical tasks and a far shorter list, and the table is what makes that conclusion arguable instead of merely defensive.
Where the design usually fails. Five traps appear in every cleanup with a deadline:
- A partial list read as the universe. The spreadsheet of whatever came back becomes the whole tenant. Publish the count next to the pagination status and freeze the decision while an unknown page remains.
- Absence converted into zero. A field that was not returned becomes “no datasets” and the workspace joins the queue. Keep a missing field and an empty list as different states in the envelope.
- Identity swapped mid-program. Another collector runs with lower permissions and the drop in items looks like cleanup. Record the identity in the snapshot and treat a swap as a new contract.
- A deadline used as a technical criterion. The renewal sets the decision date, not the coverage. If collection was partial, record the gap and keep the decision pending until you confirm it with the owner.
- Unplanned reversal. Nobody writes down how to switch back on what was switched off, and the first complaint becomes an incident. Keep the previous state queryable and define the path back before the first deactivation.
The earlier attempt and why it did not hold. This team’s first design was a scheduled script that overwrote a single table on every run. It worked for two cycles and fell to an audit question: why had a regulated area’s workspace disappeared from last month’s report? There was no answer, because that month’s run had stopped on the third page and the table only kept the latest picture. The fix was not a better script: it was accepting that an inventory needs two tables, one for what was observed and one for the limit of the observation, and that the second can never be overwritten.
How to adapt this to a smaller context. A team with a small tenant and forty workspaces does not need the four blocks kept apart. The collection contract fits in a three-line header inside the file itself, the ledger can be a tab next to the snapshot, and the committee can be one person with authority and a confirmation email. Three properties cannot be simplified: every cut needs snapshot_utc, every run has to declare where it stopped, and no deactivation may come out of a collection with an open unknown page. The tooling shrinks; the order of the questions does not.
What the committee receives. Not a deactivation list, but the observed snapshot, the coverage of that run, and whatever stayed without evidence. A declared gap costs less than restoring a workspace shut down by mistake. And there is a useful side effect: the ledger built to justify one cleanup becomes the coverage history of the following quarter, already carrying a date, an identity, and a reason on every row.
When the tenant grows: what changes in the inventory
With forty workspaces and a weekly run, coverage fits inside a conversation. With four thousand workspaces, three capacities, and daily collections, it stops being a conversation and becomes a process — and the choices that looked like details in the pilot start deciding whether anyone can still explain where the monthly count came from.
What grows is not the number of workspaces. What grows is the product of assets, expanded fields, and runs alive at the same time. Doubling the workspaces with two more expansions and two cuts a day does not double the reading volume: it multiplies it. The wrong reaction is to cut expansions until the cost fits the quota, because the richness of the field is exactly what detects change. The right reaction is to lower the frequency and declare which attributes were left out of that cycle.
Sampling has to be declared, not improvised. At scale, sweeping the whole tenant every day stops being viable. Split the universe into two populations: critical workspaces, which enter every run, and the remainder, which enters on rotation with declared coverage. The difference between that and “we collected whatever we had time for” is that the first records the selection rule next to the result, and can therefore say which fraction of the tenant was verified in each window.
The trigger becomes an event, not the calendar. Past a certain size, the periodic run always arrives late. Three events should invalidate the previous snapshot regardless of schedule: a new capacity, a tenant-setting change, and a swap of the collector identity. None of the three is rare, and all three knock down the comparison against the previous cut without leaving a visible signal on the dashboard.
A gap needs an age, or it becomes scenery. With three unknown pages, the list is irritating. With two hundred, nobody reads it. Give every coverage gap an age and treat age as severity: a page unknown for two weeks means either the budget is short or nobody owns the task, and both answers require a decision from somebody.
The real cost appears in reconciliation, not in collection. Automating the sweep is the cheap and predictable part. The bottleneck is the human reading of differences between cuts, and that cost grows with workspace turnover, not with tenant size. Organizations that create and discard workspaces per project reconcile a lot — and that is exactly where separating observation from absence pays the most, because that is where a wrong deactivation has an external reader.
The executable study and importable notebook
The summary below is computed by the executed core, not a fixture presented as a result. study-result.json retains the full output; study-excerpt.json records this reproducible subset. The function participates in relevant failure tests.
def article_excerpt(result):
partial = result["missing_page_fixture"]
return {
"synthetic": result["synthetic"],
"dry_run": result["dry_run"],
"tenant_calls": result["tenant_calls"],
"authorized_operations": result["authorized_operations"],
"complete_fixture_observed_workspaces": result["complete_fixture"]["observed_unique_workspaces"],
"partial_observed_workspaces": partial["observed_unique_workspaces"],
"next_page_status": partial["coverage_rows"][-1]["status"],
"tail_unknown": partial["tail_unknown"],
"tenant_complete": partial["tenant_complete"],
"partial_delta_preview_rows": len(partial["delta_preview"]),
}
{
"authorized_operations": 0,
"complete_fixture_observed_workspaces": 3,
"dry_run": true,
"next_page_status": "unknown",
"partial_delta_preview_rows": 5,
"partial_observed_workspaces": 2,
"synthetic": true,
"tail_unknown": true,
"tenant_calls": 0,
"tenant_complete": false
}
The package contains study.py, fixtures.json, test_study.py, and admin-inventory.ipynb. The notebook embeds the offline core and fixtures in offline_core and offline_fixture cells; its parameters cell starts with dry_run=True and write_delta=False. A fresh import does not depend on a forgotten local module.
python study.py
python -m unittest -q test_study
The CLI returns useful JSON: a complete fixture sequence with three workspaces, another interrupted after two, and a 403 attempt. All declare synthetic=true, dry_run=true, tenant_calls=0, and authorized_operations=0. There are no real administrative identities and no HTTP transport is invoked.
This excerpt inspects the partial result:
from study import run_demo
partial = run_demo()["missing_page_fixture"]
print(partial["observed_unique_workspaces"])
print(partial["coverage_rows"][-1]["status"])
print(partial["tenant_complete"])
The values are 2, unknown, and False. Seven tests cover exhaustion without completeness, a missing page retained in the preview, 401/403/429, timeout, invalid payload, budget exhaustion, conflict, and rejection of an unapproved sink. They validate the local coverage algorithm, not organizational responses, permissions, latency, or stability.
It is worth noticing what those numbers do not say. None of them compares tenants or measures performance: they compare the collector’s behavior against known responses. The exercise shows that pagination_exhausted=true coexists with tenant_complete=false, and that this coexistence is the whole point of the design. Collapsing the two into a single success indicator would produce something like “collection finished”, a phrase that hides the difference between finishing and finishing complete.
Production best practices
- Separate coverage from quantity. A dashboard should display observed assets and unresolved gaps; concealing gaps manufactures confidence.
- Version the contract. Changing filters, expansions, or identity changes the meaning of snapshot comparisons.
- Minimize collection. Metadata and names can be sensitive; do not expand users or expressions without an approved purpose.
- Handle throttling sparingly. Respect the response, budget requests, and reschedule reads rather than creating an endless loop.
- Reconcile changes. Compare identifiers, conflicts, and states without inferring deletion from incomplete collection.
- Review the writer. Decide retention, access, namespace, and concurrency behavior before promoting the preview.
- Isolate the collector identity. Administrative reads need no Lakehouse write rights or content access; separate credentials limit the damage of a wrong run.
- Give the published snapshot a rollback. Store each cut as a new row and keep the previous one queryable; without it, a coverage regression only surfaces after the decision.
- Give every gap an age. An unknown page with no conclusion after two cycles indicates an insufficient budget or a missing owner, not a scheduling delay.
- Declare the sampling rule. When the tenant does not fit one run, record which fraction was swept and by which criterion; declared partial coverage is worth more than presumed total coverage.
Frequently asked questions (FAQ)
Does HTTP 200 mean a complete inventory?
No. It means that call succeeded. Authority, filters, pagination, universe stability, and field availability require separate evidence. The status code describes the transport; coverage describes what was observed, and the two are recorded in different places.
Can I replace an absent field with zero?
No. Zero should represent a count that was actually observed. The notebook retains null and not_returned when information did not arrive. The substitution looks harmless until somebody sums the column and presents the total as a measurement of the tenant.
Can a workspace administrator inventory the tenant?
A workspace role is not the Fabric administrator contract required by the delegated API. App-only has its own enablement. This lab validates neither set of rights. Confirm the contract with whoever administers the tenant before building the schedule, not after the first empty run.
Can the notebook run in the destination Pro workspace?
Not in that workspace type. Host automation on approved Fabric capacity and account for its cost separately from the administered models. Mixing the two budgets tends to turn the inventory into the target of the next cost cut.
Does the study write anything to the tenant?
No. Local execution and notebook defaults make zero tenant calls and zero authorized operations. The Delta cell is conditional and was not executed. To go beyond the preview, review destination, identity, and retention first, and treat the enablement as a change of scope.
Conclusion
Inventory means declaring what was observed and what cannot yet be asserted. Power BI Admin APIs provide metadata; the collector must preserve the boundary of observation. A well-explained partial snapshot is more useful than a spreadsheet with artificial certainty. Before using a count to approve a change, ask which page, field, or identity still lacks evidence.
The side effect is usually the same: the conversation with whoever decides gets shorter, because it stops being about the tool and starts being about cases. A workspace with a snapshot, its coverage, and usage evidence is approved or rejected for deactivation in a single meeting — and leaves the reason on the record for whoever asks later.
Official references
- GetGroupsAsAdmin: parameters, fields, and limits.
- Service principal administrative API access.
- Metadata scanning setup.
- Notebooks: import and security context.
- NotebookUtils credentials.
- NotebookUtils limitations.
- Licenses and capacity.
- Notebook activity Connection and parameters.
👉 If you use inventories to decide changes — especially across capacities, this is the point: preserve coverage too.
Want to discuss administrative discovery? Reach out on LinkedIn.
