Repository navigation
Done
Labels
complexity: mediumdependencyfeature: securityrole: DevOps Engineersize: 5ptCan be done in 19-30 hours
Milestone
Description
Dependency
- Product: Setup Azure Hosting for non profits devops#234 (Azure grant provisioned)
- Bootstrap the Azure identities for devops-security's Terraform CI #237 (this repo's Azure CI identities)
Overview
We need this repo's Terraform to manage Azure as well as AWS, and to create the Azure identities hackforla/incubator's Terraform workflows log in with. It's the Azure counterpart of incubator-tf-plan and incubator-tf-apply in terraform/aws-gha-oidc-providers.tf.
Action Items
- Add
azurerm,azapiandazureadtorequired_providersinterraform/backend.tf, with pinned versions, logging in with OIDC from the environment the workflow sets. Setdefault_tags = { managed-by = "terraform-devops-security" }onazapi, and use a shared tags local forazurermresources. - Add an
azure/loginstep (OIDC) to the plan and apply workflows, as the plan and apply identities from Bootstrap the Azure identities for devops-security's Terraform CI #237, using this repo'sAZURE_*variables. The state stays in S3. - Create a resource group
incubator-ciin West US 2 for incubator's identities, separate from the hand-madeterraform-ci. - Create user-assigned identities
incubator-tf-planandincubator-tf-applyin it. - Add a flexible federated credential to each with
azapi_resource(Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials@2025-01-31-preview). Both checkclaims['repository_id'] eq '348201813' and claims['repository_owner_id'] eq '11635254'. Plan addsclaims['sub'] matches 'repo:*'; apply addsclaims['sub'] eq 'repo:hackforla/incubator:ref:refs/heads/main', mirroring the AWS roles. - Grant subscription-scope roles.
incubator-tf-apply: Contributor and Role Based Access Control Administrator.incubator-tf-plan: Reader and Key Vault Secrets User (so a plan can refresh Key Vault secrets, likeIncubatorTfPlanSecretsReadon AWS). - Grant Microsoft Graph permissions with
azuread_app_role_assignment.incubator-tf-apply:Application.ReadWrite.OwnedBy, so incubator can create and manage the shared app registration.incubator-tf-plan:Application.Read.All. - Output both identities' client IDs.
- Put a header comment on the new file explaining that this repo's own Azure identities are hand-made and deliberately absent, as
aws-gha-oidc-providers.tfdoes for AWS, pointing atterraform/azure-ci-bootstrap.md. - Run
terraform init -backend=falseandterraform validatewith the pinned Terraform version before opening the PR. - After the PR merges, confirm the apply run logged in to Azure and created everything, and that the next unrelated PR's plan still passes.
- After the PR merges, add the repository variables
AZURE_TENANT_ID,AZURE_SUBSCRIPTION_ID,AZURE_CLIENT_ID_PLANandAZURE_CLIENT_ID_APPLYto hackforla/incubator from the outputs. This repo has no GitHub provider, so they're set by hand.
Resources/Instructions
terraform/aws-gha-oidc-providers.tf(the AWS equivalent) andterraform/backend.tfin this repo- azapi federated identity credential
- azuread_app_role_assignment
- Flexible federated identity credentials
Metadata
Metadata
Assignees
Labels
complexity: mediumdependencyfeature: securityrole: DevOps Engineersize: 5ptCan be done in 19-30 hours
Type
Projects
- StatusShow more project fieldsDone
Activity
Add Azure providers and create incubator's Azure CI identities (#240)
ale210 commentedon Dec 1, 2026
Two action items were delivered differently in #240:
azure/loginstep. Terraform runs inside the dflook container action, which can't see the runner'sazlogin. The providers log in themselves with OIDC instead, throughARM_USE_OIDC/ARM_CLIENT_ID/ARM_TENANT_ID/ARM_SUBSCRIPTION_IDon the dflook steps; GitHub passes its OIDC token-request variables into the container. Proven by Add Azure providers and create incubator's Azure CI identities #240's plan and the post-merge apply.default_tagsonazapi. Its only resources here are federated identity credentials, which can't be tagged. Taggable resources useazurermwithlocal.azure_tags.Add Azure providers and a CI check for untagged Azure resources (#326)