Safeguard
Security Guides•

How do you move CI from access keys to OIDC without downtime?

A step by step plan to replace stored cloud access keys in CI with OIDC federation, run both side by side, then disable the old key safely and delete it.

Safeguard Security Team
4 min read

Add the OIDC role next to the existing key, switch one workflow at a time, watch CloudTrail for the old key going quiet, then disable and later delete it. Running both side by side removes the risk of a failed cutover.

What changes and what does not

Today your pipeline reads a secret access key from the CI secret store. After the move, the job asks the CI platform for a signed token, exchanges it with your cloud for temporary credentials, and uses those. The permissions of the role stay the same unless you choose to tighten them. Only how the job proves who it is changes.

The AWS best practices page supports the direction: require workloads to use temporary credentials with IAM roles, and use a web identity token exchange for workloads outside AWS such as managed CI/CD platforms.

Plan

  1. Inventory. List every pipeline and repository that uses the key. Search secret stores, workflow files and runner environment variables. Use the key's last used information to confirm which services it touches.
  2. Create the identity provider. In AWS, add an OIDC provider for your CI platform. For GitHub the provider URL is https://token.actions.githubusercontent.com, and the audience is sts.amazonaws.com when using the official action.
  3. Create the role. Copy the permissions the key's user has, then plan to trim them. Write a trust policy with exact matches on audience and subject. GitHub's guide says to define at least one condition.
  4. Grant the workflow permission to ask for a token. Set id-token: write in the workflow or job. GitHub notes this does not grant write access to other resources.
  5. Switch one low risk workflow. Use the official configure credentials action with role-to-assume. Leave the old secret in place and unused.
  6. Verify. Run the workflow and confirm in CloudTrail that the role assumption appears and the old key shows no new activity for that job.
  7. Repeat for each workflow, starting with pull request checks and ending with production deploys.
  8. Quiet period. Watch the old key's last used date for a full release cycle.
  9. Disable, then delete. Disable the key. If nothing fails after another cycle, delete it and remove the secret from the platform.

Things that go wrong

  • Subject mismatch. The most common failure. Compare the token's subject to the trust condition. GitHub says repositories created after 15 July 2026 use an immutable subject format, and renames and transfers also move to it, so copy the format from current documentation.
  • Deploys using environments. A job that references an environment presents the environment subject, not the branch. Your trust policy must match that.
  • Role chaining. If your tooling assumes a second role, AWS caps the chained session at one hour.
  • Long jobs. Credentials expire. Split long jobs or raise the role's maximum session duration to what you need, not the ceiling.
  • Forgotten consumers. Another system, such as a scheduled job, may use the same key. The last used date will show you.

Tighten while you are here

Once the role works, generate a policy from CloudTrail history with Access Analyzer and replace the broad policy. Our post on trimming a CI role covers the steps.

Rollback

Because the old key is still enabled during the migration, rollback is a one line change back to the secret. That is the point of not deleting early.

Quick check

Do I need to rewrite my pipeline to use OIDC?

Mostly no. You add a token permission and a login step, then keep the same CLI and deploy commands.

When can I delete the old key?

After a quiet period of at least one release cycle with no use, and after disabling it for another cycle without failures.

Safeguard does not manage your cloud accounts. It scans your code and dependencies, applies pull request policies and gates, and automates compliance evidence. Free scan: gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.