Skip to content

Bootstrap the Azure identities for devops-security's Terraform CI #237

Done

Description

@ale210

Dependency

Overview

We need Azure identities for this repo's Terraform workflows to log in with, and they have to be made by hand because Terraform can't create the identity it runs as. They're the Azure counterpart of the hand-made devops-security-tf-plan and devops-security-tf-apply IAM roles, and this repo's Terraform then creates incubator's Azure CI identities, as it does on AWS.

Action Items

  • Create a resource group terraform-ci in West US 2, tagged managed-by = exempt. It holds only the hand-made identities; anything Terraform creates goes elsewhere.
  • Create two user-assigned managed identities in it, devops-security-tf-plan and devops-security-tf-apply, tagged managed-by = exempt. Two identities mirror the AWS roles: plan is read-only, apply has write rights.
  • Add a flexible federated identity credential to each with az rest (ARM, API version 2025-01-31-preview; the CLI and Terraform can't create flexible credentials yet). Both check claims['repository_id'] eq '744797221' and claims['repository_owner_id'] eq '11635254', so a deleted-and-recreated repo of the same name, or one transferred out of hackforla, can't log in. Plan adds claims['sub'] matches 'repo:*'. Apply adds claims['sub'] eq 'repo:hackforla/devops-security:ref:refs/heads/main', matching the AWS apply role: terraform-apply.yaml's manual trigger applies without a reviewed plan, so apply must only be usable from main.
  • Grant Azure roles at subscription scope. Apply: Contributor and Role Based Access Control Administrator, so it can create identities and give them roles. Plan: Reader.
  • Grant Microsoft Graph application permissions (needs a Global Administrator). Apply: AppRoleAssignment.ReadWrite.All and Application.Read.All, so it can give incubator's identities their own Graph permissions. Plan: Application.Read.All. AppRoleAssignment.ReadWrite.All lets apply grant any Graph permission, itself included; that is accepted, the same footing as the AWS apply role's AdministratorAccess.
  • Add repository variables (not secrets) on this repo: AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID_PLAN, AZURE_CLIENT_ID_APPLY. They identify the identities but aren't secret.
  • Add terraform/azure-ci-bootstrap.md describing everything created here, the exact expressions and grants, and how to recreate it, since none of it is in Terraform. Link it from the README.
  • Test from a throwaway branch with a temporary workflow that runs on push: one job logs in with azure/login as plan and runs az account show (should pass), another tries to log in as apply (should be refused, because the branch isn't main). Delete the branch afterwards; it never becomes a PR. Apply's successful login is proven after the next ticket's PR merges.

Resources/Instructions

Activity

  1. transferred this issue fromhackforla/incubatoron Dec 1, 2026
  2. added
    size: 3pt
    on Dec 1, 2026
  3. added this to the 02 security milestone on Dec 1, 2026
  4. changed the title [-]Bootstrap the Azure identity for incubator's Terraform CI[/-] [+]Bootstrap the Azure identities for devops-security's Terraform CI[/+] on Dec 1, 2026
  5. removed
    size: 2pt
    on Dec 1, 2026
  6. self-assigned this
    on Dec 1, 2026
  7. moved this from New Issue Review to In progress (actively working) in CoP: DevOps: Project Boardon Dec 1, 2026
  8. ale210 commented on Dec 1, 2026

    @ale210
    MemberAuthor

    Done. Identities, credentials, roles, Graph grants and repository variables created by hand and verified; login test passed (plan logged in, apply refused from a non-main branch, run); documented in #239.

  9. moved this from In progress (actively working) to Done in CoP: DevOps: Project Boardon Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions