Skip to content

Azure setup: grant only Application.ReadWrite.OwnedBy - #471

Draft
bengreenberg5 wants to merge 1 commit into
mainfrom
ben/azure-minimal-graph-permissions
Draft

Azure setup: grant only Application.ReadWrite.OwnedBy#471
bengreenberg5 wants to merge 1 commit into
mainfrom
ben/azure-minimal-graph-permissions

Conversation

@bengreenberg5

Copy link
Copy Markdown
Contributor

Summary

Companion to porter-dev/code#8127 (RUN-4375). Porter's only Microsoft Graph operation is managing federated identity credentials on its own app registration, so the setup script now grants a single, ownership-scoped permission instead of seven tenant-wide ones.

Script changes (scripts/setup-azure-porter-wif.sh)

  • add_api_permissions grants only Application.ReadWrite.OwnedBy.
  • New ensure_app_owner makes the service principal an owner of its own app registration (az ad app owner add) — OwnedBy only reaches registrations the caller owns. Runs on every invocation, like assign_custom_role.
  • New remove_legacy_api_permissions strips Application.ReadWrite.All, Directory.ReadWrite.All, Domain.Read.All, Group.Create, Group.ReadWrite.All, RoleManagement.ReadWrite.Directory, and User.ReadWrite.All from an app registration that still carries them. It removes both the manifest entries and the admin-consented app role assignments — az ad app permission delete alone leaves the consent grant in place, and the grant is what puts the permission in the token.
  • Order in main: create_app_registration → assign_custom_role → ensure_app_owner → add_api_permissions → grant_admin_consent → remove_legacy_api_permissions → create_federated_credential.

Docs

cloud-accounts/connecting-a-cloud-account.mdx describes the new steps and what the single permission does.

Merge order

Merge after porter-dev/code#8127 is deployed. Until then Porter's connect-time check rejects an app registration that holds only OwnedBy.

Verification

bash -n and shellcheck -S warning clean. Not yet run against a live tenant — that's part of the e2e checklist on the code PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G3cL9QN3RQYJ3R8zTiervJ

Porter's only Microsoft Graph operation is managing federated identity
credentials on its own app registration. The script granted seven tenant-wide
Graph permissions inherited from the client-secret era; replace them with
Application.ReadWrite.OwnedBy, make the service principal an owner of its own
app registration (OwnedBy only reaches registrations the caller owns), and
remove the legacy grants — manifest entries and consented app role
assignments — from app registrations that still carry them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3cL9QN3RQYJ3R8zTiervJ
@mintlify

mintlify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
porter 🟢 Ready View Preview Aug 28, 2026, 5:37 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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