Skip to content

Azure: refusals and names as main reads them, and a service principal's reach - #109

Merged
odgrim merged 4 commits into
mainfrom
track-a/azure-release-gaps
Dec 6, 2026
Merged

odgrim merged 4 commits into
mainfrom
track-a/azure-release-gaps

Conversation

@odgrim

@odgrim odgrim commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Change

Azure reads az's refusals and names as Runbooks main does, and a service principal's reach stops offering a signInTo it refuses.

  • Refusals. AADSTS50132 and 500133 need a sign-in. 50059, 530003 and 530032 are no access. With no known code, "does not exist in tenant" and "not found in the directory" are no access, and "Please run 'az login'" and "not logged in" need a sign-in. A failed az call that says the no-login words stays notSignedIn, not expired.
  • Tenant names. A tenant option reads "Contoso · contoso.com" when Azure gives a name and a domain. When Azure's tenant list leaves a tenant out or cannot be read, the name comes from the login's own tenantDisplayName and tenantDefaultDomain.
  • Subscription names drop control characters and are cut at 256, as tenant names are.
  • Service principal reach. Any refusal is noAccess, since signInTo refuses a service principal. A timeout or an unclassified failure stays unknown.

Decisions

  • az::Tenant holds display_name and domain apart, and name() gives the display name, else the domain. Accounts gains named. Both are public in runbooks-credential-azure, a crate nothing outside this repo uses.
  • Accounts.defaults stays the only list of the tenants a login holds. named only names them, so a tenant named lacks shows its id and is never dropped.
  • A tenant target reads "Name · domain" wherever it appears: targets' options and identity.targets.tenant after signIn or select. reach's name and AZURE_TENANT_NAME stay the display name, else the domain.
  • The label separator is "·", as Runbooks main's was.

Gaps

  • Where this differs from Runbooks main's classifyTokenError:
    • "az login", "No subscription found" and "refresh token has expired" are not refusals here, so a user's reach answers unknown where main says a sign-in is needed;
    • this takes the first known code in the text, then the words, where main ranks MFA, then no access, then sign-in, over codes and words together, so "AADSTS50132 … AADSTS50076" reads as a sign-in here and MFA in main;
    • this matches without regard to case.
  • Untested: a service principal's timeout and unclassified failure staying unknown, and Tenant::name preferring the display name to the domain.
  • A tenant is named by its first account entry in the login; a later entry with a name doesn't name it. A tenant /tenants lists with only a domain shows the domain, not the login's display name.
  • A service principal's noAccess message ends "Sign in with that tenant ID.", which a service principal can't do.
  • DisplayName drops control characters only, so U+202E and U+2028 pass.
  • az's error text is quoted in reach messages unredacted, cut to 1024 characters, as before.
  • Principal names are not cleaned: they are Entra UPNs or client ids.
  • Stacked above: Azure: a refused select leaves az's default where it was #110, Azure: reach and signInTo take a tenant domain #111, Azure: identity expiry, a failed refresh, toolMissing from the cli source, and resume directories #112, Azure: interactionRequired names the tenant to sign in to #115.

Evidence

  • mise run check at 1dd85fd, with main merged in: 507 tests run: 507 passed, 0 skipped, lint clean, semver no publishable crates.
  • Each test failed before its fix:
    • a_refusal_is_named_by_its_aadsts_code_or_its_words: ERROR: AADSTS50132: what Azure says. left: None right: Some(NeedsSignIn), then Application with identifier 'x' was not found in the directory 'Fabrikam'. left: None right: Some(NoAccess).
    • a_service_principal_refuses_sign_in_to_so_a_refusal_is_no_access: left: [String("needsSignIn"), String("needsMfa"), String("reachable")] right: [String("noAccess"), String("noAccess"), String("reachable")].
  • Hand mutants, each failing one test (179 passed, 1 failed):
    • the label without its domain: a_tenant_shows_its_name_and_domain;
    • held tenants never named: visible_tenants_merge_listed_held_and_signed_in_once_each;
    • the login's display name not read, and a raw subscription name: the_login_names_its_tenants_and_its_subscriptions_cleaned.
  • az writes tenantDisplayName and tenantDefaultDomain only on accounts from the subscription listing: azure-cli 2.93.0, the version mise.toml pins, azure/cli/core/_profile.py:34-35,946-958. Tenant-level accounts (_build_tenant_level_accounts, 484-493) carry no names.
  • Audit dependencies is red, as on main, until the pin-project-lite 0.2.19 lock update.

@odgrim
odgrim changed the base branch from track-a/azure-reach-gaps to main December 5, 2026 16:30
@odgrim
odgrim force-pushed the track-a/azure-release-gaps branch from f010db4 to ad6ec25 Compare December 6, 2026 07:03
@odgrim
odgrim changed the base branch from main to track-a/schema-release-text December 6, 2026 07:03
50132 and 500133 need a sign-in; 50059, 530003 and 530032 are no
access. "does not exist in tenant" and "not found in the directory"
are no access, and az's no-login words, "Please run 'az login'" and
"not logged in", need a sign-in. A failed az call that says those
words stays notSignedIn, not expired.
A tenant option reads "Contoso · contoso.com" when Azure gives both.
The login's own tenantDisplayName and tenantDefaultDomain name a
tenant that Azure's tenant list leaves out or cannot list.
Subscription names are cleaned as tenant names are.
A service principal can't signInTo, so reach no longer offers
needsSignIn or needsMfa for it. A timeout or an unclassified failure
stays unknown.
@odgrim
odgrim force-pushed the track-a/azure-release-gaps branch from ad6ec25 to f65c016 Compare December 6, 2026 07:48
@odgrim
odgrim changed the base branch from track-a/schema-release-text to main December 6, 2026 15:26
@odgrim
odgrim marked this pull request as ready for review December 6, 2026 15:43
@odgrim
odgrim merged commit 037e83d into main Dec 6, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant