Background
The template-infra-azure currently has capabilites to establish OIDC-based federated identity between GitHub Actions and Azure through module auth-github-actions. This module creates an Azure AD app registration, service principal, federated identity credential, and the necessary role assignments.
Some projects also use Azure DevOps Pipelines as a CI/CD provider. The template-infra-azure needs the capabilities to establish OIDC-based federated identity between Azure DevOps and Azure.
Technical Considerations
- Unlike Github, ADO OIDC subject claims are not customizable, and we must structure the OIDC claim as provided by Azure DevOps
Technical Implementation Approach
- Create
infra/modules/auth-ado-pipelines/:
main.tf — define to mirror auth-github-actions/main.tf but with azureadd_application_federated_identity_credential using a Azure DevOps OIDC issuer URL and subject claim
- Same role assignments as the GitHub module (Contributor, Key Vault Secrets Officer, Key Vault Certificates Officer, RBAC Administrator, Storage Blob Data Contributor on tf state)
variables.tf - inputs:
name - display name for the Azure AD app registration
ado_organization_id - ADO org GUID (used in issuer URL)
ado_organization_name - ADO org name (used in subject claim)
ado_project - ADO project name
ado_service_connection_name -
tf_state_storage_container_scope
- `resource_owners
outputs.tf - expose client_id and object_id (same as auth-github-actions)
- Add
ci_cd_provider variable to project-config:
ci_cd_provider = "github" # or "azure_devops"
Also add ADO-specific locals (only required when ci_cd_provider = "azure_devops"):
ado_organization_id - ADO org GUID (used in issuer URL)
ado_organization_name - ADO org name
ado_project - ADO project name
Expose all of these via outputs.tf
- Wire up in
infra/accounts/main.tf- Use project-config ci_cd_provider to conditionally instantiate the appropriate auth module: auth_ado_pipeline or auth_github_actions
Document Setup flow in docs/infra/set-up-azure-devops.md (equivalent of docs/infra/set-up-github.md):
- Setup project-config/main.tf local variable
ci_cd_provider
- Run
make infra-set-up-account → Terraform creates the Azure AD app + federated credential
- Note the
client_id from the auth_ado_pipelines outputs
- Create the ADO service connection (Workload Identity Federation type) using that
client_id - the connection name must match ado_service_connection_name
Out of scope
- no
bin/set-up-github equivalent script needed - ADO subject claims are not customizable.
Background
The
template-infra-azurecurrently has capabilites to establish OIDC-based federated identity between GitHub Actions and Azure through moduleauth-github-actions. This module creates an Azure AD app registration, service principal, federated identity credential, and the necessary role assignments.Some projects also use Azure DevOps Pipelines as a CI/CD provider. The
template-infra-azureneeds the capabilities to establish OIDC-based federated identity between Azure DevOps and Azure.Technical Considerations
Technical Implementation Approach
infra/modules/auth-ado-pipelines/:main.tf— define to mirrorauth-github-actions/main.tfbut withazureadd_application_federated_identity_credentialusing a Azure DevOps OIDC issuer URL and subject claimvariables.tf- inputs:name- display name for the Azure AD app registrationado_organization_id- ADO org GUID (used in issuer URL)ado_organization_name- ADO org name (used in subject claim)ado_project- ADO project nameado_service_connection_name-tf_state_storage_container_scopeoutputs.tf- exposeclient_idandobject_id(same asauth-github-actions)ci_cd_providervariable toproject-config:ci_cd_provider = "github" # or "azure_devops"Also add ADO-specific locals (only required when
ci_cd_provider = "azure_devops"):ado_organization_id- ADO org GUID (used in issuer URL)ado_organization_name- ADO org nameado_project- ADO project nameExpose all of these via
outputs.tfinfra/accounts/main.tf- Use project-configci_cd_providerto conditionally instantiate the appropriate auth module:auth_ado_pipelineorauth_github_actionsDocument Setup flow in
docs/infra/set-up-azure-devops.md(equivalent ofdocs/infra/set-up-github.md):ci_cd_providermake infra-set-up-account→ Terraform creates the Azure AD app + federated credentialclient_idfrom theauth_ado_pipelinesoutputsclient_id- the connection name must matchado_service_connection_nameOut of scope
bin/set-up-githubequivalent script needed - ADO subject claims are not customizable.