The Simplest Way to Make Azure Active Directory and GitHub Actions Work Like They Should
Teams pair azure active directory and github actions to run build pipelines with cloud identities. The directory checks runner requests and grants short-lived roles to deploy code and update databases. In older setups, engineers pasted static cloud keys into repo settings. Those keys lived for months and gave pipelines way too much power. When a build log leaked a key, attackers could read cloud storage right away. Linking your directory with your build runners fixes this risky habit. The runne
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair azure active directory and github actions to run build pipelines with cloud identities. The directory checks runner requests and grants short-lived roles to deploy code and update databases.
In older setups, engineers pasted static cloud keys into repo settings. Those keys lived for months and gave pipelines way too much power. When a build log leaked a key, attackers could read cloud storage right away. Linking your directory with your build runners fixes this risky habit. The runner proves who it is on every single job run.
How azure active directory and github actions share trust
The link between these two tools relies on OpenID Connect trust rules. Your build runner starts a job and asks its platform for a signed token. This token states the repo name, branch, and workflow context. The runner sends this token to the cloud directory to log in.
The directory reads the token claims and checks them against a trust rule. You set up this rule on a cloud app registration or user identity. If the repo name and branch match the rule, the directory sends back an access token. The runner uses that short-lived token to talk to cloud resources.
No human has to copy or rotate passwords with this flow. The token dies as soon as the build job finishes or times out. Permissions flow from the cloud role tied to that specific app identity. You can give one branch read rights and another branch write rights.
Common failure modes and how to scope roles
Many teams still fall into bad habits when they set up federation. The most common mistake is using wildcard rules in the subject claim check. If you allow any branch in a repo to log in, pull requests get full access. A bad actor or careless commit on a feature branch can trigger prod changes.
Shared service identities cause another big problem for platform teams. Teams often point ten different repos at one high-power directory identity. When a database query or cloud change fails, the audit logs look the same. You cannot tell which repo or workflow run actually ran the bad command.
Active Directory + GitHub Actions Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Broad cloud roles make these shared identities even worse in daily work. Engineers often grant owner or contributor rights at the whole subscription level. If a build runner needs to run one database migration, it should not control virtual networks.
To fix this, create one cloud identity for each repo and target stage. Lock the trust rule to a single branch or a checked deployment stage. Grant the cloud role only on the exact resource group the job touches. Check your directory sign-in logs each week to spot weird runner calls.
Securing database and server steps during workflow runs
Cloud deployment is only half of what a modern pipeline does. Workflows also run SQL migrations, check data, and run scripts on internal servers. Standard cloud federation gets the runner into the cloud network, not safely into data stores.
Teams often hide database passwords in repo secrets to handle these final steps. That brings back the exact static secret problem you worked to remove. Anyone who can edit the workflow file can print that database password to the logs.
A better pattern maps the runner identity directly to exact database actions. Every query from a pipeline should leave a clear audit trail by repo. Sensitive columns like emails, phone numbers, card numbers, or national IDs need protection during test runs. Dynamic data masking rewrites matched fields in results so build logs stay clean.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Why should we stop using static client secrets in workflows?
Static secrets do not expire on their own and often lack tight network checks. If a secret leaks in a build log, anyone can use it from anywhere. Federated tokens expire fast and only work for the exact branch you allow.
How do we stop feature branches from touching prod resources?
Set your directory trust rule to match only your main branch or prod stage. Create a second identity with read-only rights for pull requests and test branches. The cloud directory will block any token that comes from the wrong branch.
Can we trace which workflow run changed a cloud resource or database?
Yes, if you give each workflow its own identity and log every session. Cloud activity logs record the app identity and token claims for each call. For databases, query logs should record the caller identity alongside every SQL statement.
Related guides
In this post