Repository navigation
Secretless OIDC deployment identity with just-in-time roles (#500) - #903
Merged
Roger Doherty (MSFT) (doherty100) merged 4 commits intoOct 20, 2026
Merged
Roger Doherty (MSFT) (doherty100) merged 4 commits into
Roger Doherty (MSFT) (doherty100) merged 4 commits into
Conversation
Add a third auth mode, oidc, so the Sandbox deployment workflow signs in with GitHub Actions OIDC to an unattached user-assigned managed identity that holds standing Reader only. The operator grants time-bound Contributor and conditioned Role Based Access Control Administrator before approving each run. - rg-devops-iac: deployment_identity accepts oidc, creating the unattached identity, standing Reader, and per-environment federated credentials with custom subjects (repository_id, environment, workflow_ref). The repository owner/name is derived from the repository-level github_runner_url. New github_repository_id, github_oidc_environments and github_oidc_workflow_ref inputs, and deployment_identity_github_subjects and deployment_identity_jit_condition outputs. - Root: auth_mode accepts oidc and wires use_oidc into all providers. - Workflow: only the sandbox job gets id-token: write (asserted by Test-SandboxDeploymentSelection.sh). - Deployment scripts: re-login per stage with a fresh GitHub ID token, preflight waits for the JIT roles and enforces a minimum remaining window (SANDBOX_JIT_MIN_REMAINING_MINUTES, default 150), and apply and unit-test re-check the roles. Invoke-UnitTests.ps1 gains -SessionRefresh to re-authenticate before each test suite. - The state backend keeps using the VM's system-assigned identity. - Docs: rg-devops-iac README OIDC setup and portal JIT procedure, root README, CONTRIBUTING.md and copilot instructions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Match the federated credential subjects to the subject claim template
{"include_claim_keys":["repository_owner_id","repository_id","context"]}
that organizations commonly require, instead of overriding the
repository's template with a workflow_ref-based one.
- Replace github_oidc_workflow_ref with github_repository_owner_id.
- Drop the repository-URL requirement on github_runner_url for oidc.
- README: check the existing template first and set it only when the
repository uses the default; document the workflow-file trade-off.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Derive github_repository_id and github_repository_owner_id from the repository in github_runner_url with an anonymous GitHub API request (hashicorp/http data source), so oidc needs no extra tfvars for public repositories. Both variables remain optional overrides for private repositories or to skip the lookup. The request is unauthenticated because data source arguments are saved in state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a maintainer section listing the environment and OIDC subject template settings that restrict the deployment identity, and link the release approval step to emergency merges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Roger Doherty (MSFT) (doherty100)
marked this pull request as ready for review
October 20, 2026 16:55
Roger Doherty (MSFT) (doherty100)
requested a review
from a team
as a code owner
October 20, 2026 16:55
Roger Doherty (MSFT) (doherty100)
deleted the
feature/500-oidc-deployment-identity
branch
October 20, 2026 17:13
This was referenced Oct 20, 2026
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.
Purpose
Implements #500. The Sandbox deployment workflow now authenticates the root sandbox providers with GitHub OIDC. It federates to a user-assigned managed identity that is not attached to
jumplinux2and holds standingReaderonly. Before approving each run, the operator grants it time-boundContributorand ABAC-conditionedRole Based Access Control Administratorin the portal.deployment_identitygainsoidc. This creates the unattached identity, a standingReaderassignment and one federated identity credential per environment. The subjects use immutable ids (repository_owner_id:<id>:repository_id:<id>:environment:<name>) to match the repository's existing OIDC subject claim template, so no repository override is needed. The ids are looked up anonymously from the GitHub API usinggithub_runner_url(newhashicorp/httpprovider).github_repository_idandgithub_repository_owner_idare optional overrides for private repositories. New outputs:deployment_identity_github_subjectsanddeployment_identity_jit_condition.auth_modeacceptsoidc, anduse_oidcis wired intoazurerm,azapiandazuread. The state backend still uses the VM's system-assigned identity.sandboxjob getsid-token: write, and the workflow is now OIDC-only.SANDBOX_JIT_MIN_REMAINING_MINUTESremain (default 150). Apply and unit-test recheck the roles before they start.Invoke-UnitTests.ps1 -SessionRefresh).id-tokenscope.Teardown stays manual. The workflow never destroys a sandbox.
Does this introduce a breaking change?
Existing
client_secretandmanaged_identitymodes are unchanged. The workflow now requiresauth_mode = "oidc". To migrate:deployment_identity = "oidc".SANDBOX_TFVARS_HCLin both environments (auth_mode = "oidc",client_id= thedeployment_identity_client_idoutput).Pull Request Type
How to Test
deployment_identity = "oidc". Verify the identity has onlyReader, the federated credential subjects matchdeployment_identity_github_subjects, andjumplinux2has a system-assigned identity only.main: grant the time-bound roles, approve a Sandbox deployment run, and confirm preflight, apply and unit-test pass.What to Check
./scripts/Invoke-CIChecks.shpasses. Locally,powershellandsecretsreport only the known git-ignored.terraformandterraform.tfstatefalse positives (Invoke-CIChecks.sh: exclude .terraform directories from the PSScriptAnalyzer check #902).main, because environments are restricted tomain.Other Information
vnext, so Secretless, approval-gated GitHub OIDC access to an unattached deployment UAMI #500 will be closed manually after release.