Your Azure pipelines, with no secrets to manage

One morning the deployment fails. Nothing has changed in the code. The error mentions an expired secret, and nobody remembers who created it or where else it is used. That secret is the password your pipeline uses to get into Azure. You can do without it entirely.

Guide3 min read

The password hiding behind every pipeline

To deploy, an Azure DevOps or GitHub Actions pipeline has to sign in to Azure. Very often it does that with a service principal and its client secret: a password stored in a service connection or in the repository secrets.

That password causes two problems. It expires, and on that day your deployments stop, usually at the worst possible moment. And it can be copied: into a script, onto a laptop, into a ticket. Anyone who has it can do in Azure whatever the pipeline can do, from anywhere.

Trust instead of a password

Microsoft offers another way: workload identity federation. Instead of giving the pipeline a password, you tell Entra ID to trust Azure DevOps or GitHub, but only for one specific repository, branch or environment.

On every run, the pipeline gets a token that is valid for a few minutes. There is nothing left to store, nothing to copy and nothing to expire on a Monday morning. A stolen token is close to useless, because it stops working shortly after.

In Azure DevOps

An Azure Resource Manager service connection can use workload identity federation. For a new connection, that is the option to pick. For an existing connection that uses a secret, Azure DevOps lets you convert it from the service connection page, without touching your pipelines.

Convert one in a test project first, run a deployment, then move on to the rest.

In GitHub Actions

On the Azure side, you add a federated credential to an app registration or a managed identity. It says which repository, and which branch or GitHub environment, is allowed to sign in.

On the GitHub side, the azure/login action only gets the client, tenant and subscription IDs, with no secret. The job just needs permission to request a token, with id-token: write.

Permissions that fit the pipeline

Removing the password does not fix everything. If the pipeline identity is Owner of the whole subscription, one mistake in a script can still break everything. Give it only the role it needs, on the resource group it deploys to.

Use one identity per environment. The production one should only work from the pipeline's production environment, the one that asks for an approval before it deploys.

Clean up

Once your connections are converted and tested, the old secrets are no longer needed. They do stay valid until they expire, though. Delete them, or the risk of a leak is still there.

Where to start

List your service connections and the GitHub secrets used to reach Azure. Start with the one whose secret expires first: convert it, test a deployment, then delete the old secret. The others follow the same way.

That is exactly what our DevOps services are about.

DevOps & automationReproducible pipelines, infrastructure described as code and end-to-end observability.

All articles

A project, an overloaded team, an audit? Let's talk.

Reply within two business days, in English, French or Dutch. NDA on request.

[email protected]

The context, what you want to achieve and by when: a few lines are enough.

We only use your details to reply to you. Privacy