Skip to content

Commit

Permalink
feat: Allow ACR authentication using Azure CLI
Browse files Browse the repository at this point in the history
Install azure-cli in Docker image in order to use the `az acr login` command.

Can be used with Azure Managed Identities with the following script:

```yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-image-updater-config
  namespace: argocd
data:
  log.level: debug
  registries.conf: |
    registries:
    - name: acrexample
      api_url: https://acrexample.azurecr.io/
      prefix: acrexample.azurecr.io
      ping: yes
      insecure: no
      credentials: ext:/app/scripts/acr-login.sh
      credsexpire: 10h
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-image-updater-config-acr
  namespace: argocd
data:
  acr-login.sh: |
    #!/bin/sh
    LOGIN=$(az login --identity)
    REGISTRY="acrexample"
    TOKEN=$(az acr login --name $REGISTRY --expose-token --output tsv --query accessToken)
    echo "00000000-0000-0000-0000-000000000000:$TOKEN"
```

Closes argoproj-labs#550 and argoproj-labs#473

Signed-off-by: Francesc Arbona <[email protected]>
  • Loading branch information
xescab committed Sep 8, 2023
1 parent 5366cc1 commit 0154a7b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN apk update && \
apk add ca-certificates git openssh-client python3 py3-pip && \
pip3 install --upgrade pip && \
pip3 install awscli && \
apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo make && \
pip3 install azure-cli && \
rm -rf /var/cache/apk/*

RUN mkdir -p /usr/local/bin
Expand Down

0 comments on commit 0154a7b

Please sign in to comment.