Repository navigation
Name the Azure roles a deploy needs and explain AuthorizationFailed - #52
Open
autoidm-jon wants to merge 2 commits into
Open
autoidm-jon wants to merge 2 commits into
autoidm-jon wants to merge 2 commits into
Conversation
|
PR tier:
A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/37006898248 |
autoidm-jon
force-pushed
the
azure-missing-role-guidance
branch
from
October 7, 2026 20:39
9d11c81 to
49aec96
Compare
A Global Administrator with no RBAC role on the subscription gets (AuthorizationFailed) from every az call, and nothing said what to do. Now the README's Azure section names the required role (Owner, assigned Active and Permanent), gives the pdt az commands that list the roles you hold, and walks through the two grant paths, including the Entra elevate-access toggle and the PIM Eligible-vs-Active trap. run_quiet detects the error and prints the same steps in the terminal. Claude-Session: https://claude.ai/code/session_01PAWicHmNWiso8hYuYK8AfA
autoidm-jon
force-pushed
the
azure-missing-role-guidance
branch
from
November 3, 2026 19:33
49aec96 to
8977724
Compare
Contributor cannot create role assignments, and deploy makes three of them (Key Vault Secrets Officer for the deployer, Key Vault Secrets User and AcrPull for the job identity), but Owner is not the only role that can. Role Based Access Control Administrator adds exactly that right. The README and the terminal guidance now name Contributor plus Role Based Access Control Administrator, with Owner as the one-role alternative, and the terminal message reads the denied action out of the error so an account that already has Contributor is told to add only the grant role. The PIM Assignment type step is described as conditional, since it only appears on subscriptions that use Privileged Identity Management.
autoidm-jon
force-pushed
the
azure-missing-role-guidance
branch
from
November 3, 2026 19:38
8977724 to
2d21d31
Compare
Contributor
Author
|
Goal: when a deploy fails with AuthorizationFailed, pdt names the Azure role that is missing and explains how to get it, and the docs list the minimum roles. Reviewer: Cursor
Rebase onto main (115 commits):
Checks that passed: |
|
PR tier:
A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/41847620266 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A user whose account has no RBAC role on the subscription (common: a tenant Global Administrator on a subscription someone else created) gets
(AuthorizationFailed) ... does not have authorization to perform action ...from every az call, with no guidance. A user who has Contributor gets the same error later, fromaz role assignment create, and is equally stuck.Owner is not required. Deploy makes three role assignments (Key Vault Secrets Officer for the deployer, Key Vault Secrets User and AcrPull for the job identity), and Contributor explicitly excludes
Microsoft.Authorization/*/Write. The built-in role Role Based Access Control Administrator adds exactly that right, so the least a deploy needs is Contributor plus Role Based Access Control Administrator. Owner works too, as one role instead of two.pdt azcommands to list the roles you hold. If Azure says AuthorizationFailed explains how to read the denied action in the error (roleAssignments/writemeans "add the grant role", anything else means "add both"), then walks the two grant paths: ask someone who can grant roles (with the PIM Assignment-type Eligible-vs-Active trap, marked as only appearing on subscriptions that use PIM), or the Global Administrator elevate-access toggle in Entra ID → Properties, plus the fresh sign-in (pdt login <app>) afterward.run_quietdetects the error on its failure path and prints the same steps in the terminal, per the guiding principle that a missing permission prints the exact role the user must add.denied_actionreads the action out of the error so an account that already has Contributor is told to add only the grant role. The RBAC-propagation retry behavior is unchanged; the transient check reuses the new predicate instead of duplicating the strings.test_azure_auth_help.pyfakes the subprocess result and covers the no-role message, the cannot-grant message, the action parser, that Owner is never stated as required, and that unrelated failures stay generic. No network, no cloud account.The elevate-access path was verified by walking a real tenant (Global Admin, zero RBAC) through the portal. Role definitions are from the Azure built-in roles reference (Privileged category).
🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to README guidance and clearer failure output in
run_quiet; deploy’s role-assignment behavior is unchanged.Overview
Documents the Contributor and Role Based Access Control Administrator roles Azure deploy needs (with Owner as an optional one-role alternative), plus
pdt azcommands to inspect your assignments. Adds an AuthorizationFailed troubleshooting section covering denied-action interpretation, IAM grant steps (including PIM Active/Permanent), and the Entra Global Administrator “Access management for Azure resources” elevation path.When
run_quiethits an Azure authorization failure, deploy now parses the denied action and prints matching remediation (only the grant role ifroleAssignments/writefailed; both roles otherwise), reusing the same detection for RBAC-propagation retries. New unit tests cover the parser and both message paths without calling Azure.Reviewed by Cursor Bugbot for commit 2486c640d63a1e9ac3b832708fac055bf398957e. Bugbot is set up for automated code reviews on this repo. Configure here.
Moved from GitLab
autoidm/pdt!28(https://gitlab.com/autoidm/pdt/-/merge_requests/28), opened by visch on 2026-09-01.