{"id":26829427,"url":"https://github.com/rgl/terraform-azure-github-actions-oidc-auth","last_synced_at":"2026-04-12T15:44:52.526Z","repository":{"id":285120372,"uuid":"957051943","full_name":"rgl/terraform-azure-github-actions-oidc-auth","owner":"rgl","description":"Terraform example that configures an authentication federation between Microsoft Entra ID and GitHub Actions OIDC.","archived":false,"fork":false,"pushed_at":"2025-03-29T16:30:44.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T17:24:56.496Z","etag":null,"topics":["azure","github-actions","oidc","terraform"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-29T12:45:12.000Z","updated_at":"2025-03-29T16:30:47.000Z","dependencies_parsed_at":"2025-03-29T17:25:01.329Z","dependency_job_id":"a0392b65-a322-46db-9508-c460bddc41f0","html_url":"https://github.com/rgl/terraform-azure-github-actions-oidc-auth","commit_stats":null,"previous_names":["rgl/terraform-azure-github-actions-oidc-auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-azure-github-actions-oidc-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-azure-github-actions-oidc-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-azure-github-actions-oidc-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fterraform-azure-github-actions-oidc-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/terraform-azure-github-actions-oidc-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246320198,"owners_count":20758410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","github-actions","oidc","terraform"],"created_at":"2025-03-30T13:16:37.465Z","updated_at":"2026-04-12T15:44:52.487Z","avatar_url":"https://github.com/rgl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\n[![Build](https://github.com/rgl/terraform-azure-github-actions-oidc-auth/actions/workflows/build.yml/badge.svg)](https://github.com/rgl/terraform-azure-github-actions-oidc-auth/actions/workflows/build.yml)\n\nTerraform example that configures an authentication federation between Microsoft Entra ID and GitHub Actions OIDC.\n\nThis lets us use Azure from a GitHub Actions Workflow Job without using static secrets.\n\nIt uses the GitHub Actions Workflow Job OIDC ID Token to authenticate in Azure.\n\nThis will:\n\n* Configure Microsoft Entra ID.\n  * Create the GitHub Actions OIDC Federation.\n  * Create a User-Assigned Managed Identity to represent the GitHub Actions Workflow Identity.\n    * This identity will have `Reader` permissions in the entire Azure subscription.\n* Configure GitHub Repository.\n  * Add the Azure related environment variables as GitHub Actions Variables.\n    * Please note that these values are not sensitive to me, as such, they are not saved as GitHub Actions Secrets, but YMMV.\n* Show the [Build GitHub Actions Workflow](https://github.com/rgl/terraform-azure-github-actions-oidc-auth/actions/workflows/build.yml).\n  * It has two example jobs:\n    1. `build-with-azure-cli`: Login into Azure using the [azure/login action](https://github.com/Azure/login), then use the Azure CLI to interact with Azure.\n    2. `build-with-curl`: Use `curl` to request a GitHub Actions OIDC ID Token, exchange it for an Azure Access Token, then interact with Azure.\n\n# Usage\n\nInstall the dependencies:\n\n* [Visual Studio Code](https://code.visualstudio.com).\n* [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).\n\nOpen this directory with the Dev Container plugin.\n\nOpen the Visual Studio Code Terminal.\n\nLogin into Azure:\n\n```bash\naz login\n\n# list the subscriptions.\naz account list --all\naz account show\n\n# set the subscription.\nexport ARM_SUBSCRIPTION_ID=\"\u003cYOUR-SUBSCRIPTION-ID\u003e\"\naz account set --subscription \"$ARM_SUBSCRIPTION_ID\"\naz account show\n```\n\nLogin into GitHub:\n\n```bash\ngh auth login\ngh auth status\n```\n\nProvision the azure infrastructure:\n\n```bash\nexport CHECKPOINT_DISABLE=1\nexport TF_LOG=INFO # ERROR, WARN, INFO, DEBUG, TRACE.\nexport TF_LOG_PATH=terraform.log\nrm -f \"$TF_LOG_PATH\"\nterraform init\nterraform apply\n```\n\nManually trigger the [Build GitHub Actions Workflow](https://github.com/rgl/terraform-azure-github-actions-oidc-auth/actions/workflows/build.yml) execution and watch it use Azure without using any static secret.\n\nWhen you are done, destroy everything:\n\n```bash\nterraform destroy\n```\n\nList this repository dependencies (and which have newer versions):\n\n```bash\nGITHUB_COM_TOKEN='YOUR_GITHUB_PERSONAL_TOKEN' ./renovate.sh\n```\n\n# References\n\n* [Azure: Login With OpenID Connect (OIDC)](https://github.com/azure/login?tab=readme-ov-file#login-with-openid-connect-oidc-recommended).\n* [Azure: Managed identities](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/).\n* [GitHub: About security hardening with OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect).\n* [GitHub: Variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables).\n* [GitHub: Secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-azure-github-actions-oidc-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fterraform-azure-github-actions-oidc-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fterraform-azure-github-actions-oidc-auth/lists"}