fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.3k stars 588 forks source link

Support workload identity for Azure Devops Git repos #4357

Open Poltergeisen opened 10 months ago

Poltergeisen commented 10 months ago

My goal is to have no manually created secrets. Workload identity for git repos is my last step.

I'd like to see Azure Devops repositories set so that I can use a managed identity to pull and update source code.

If this is already supported then I think the documentation should give examples of how to use it when connecting to Azure Devops

alangilmor commented 3 months ago

Have a look here.

Using Workload Identity to obtain an access token to Azure Devops, you can interact with the repo via git+https.

Create a Pod that has the federated credential, install az cli, and use the az login command from the last comment in this open issue here.

Use this instruction from Microsoft's guidance in the first link above ^^^ az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv.

Then clone the repo via git -c http.extraheader="AUTHORIZATION: bearer <your access token>"

So it looks like 2 small changes are required: