vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.67k stars 1.4k forks source link

Azure Workload Identity authentication with AD fails #8324

Open idanme-tr opened 1 day ago

idanme-tr commented 1 day ago

What steps did you take and what happened:

I am trying to deploy Velero Helm charts to AKS using Workload Identity. I've followed the Azure plugin guide with workload identity configurations.

For some reason, Velero cannot retrieve the storage account's properties. I've provided the managed identity with more permissions than needed to make sure I do not miss anything.

I understand that this issue might not be a bug but a misconfiguration, but I can't find what it is. When I am using Storage account key and not Workload identity it works fine.

What did you expect to happen: I expected Velero to be able to authenticate using the workload identity and to be able to backup and restore as it should.

The following information will help us better understand what's going on:

If you are using velero v1.7.0+:
Please use velero debug --backup <backupname> --restore <restorename> to generate the support bundle, and attach to this issue, more options please refer to velero debug --help

bundle-2024-10-20-11-47-04.tar.gz

If you are using earlier versions:
Please provide the output of the following commands (Pasting long output into a GitHub gist or other pastebin is fine.)

Anything else you would like to add:

I am adding my Helm configurations. Lines that were commented out were different attempts but were also unsuccessful.

velero:
  configuration:
    backupStorageLocation:
      - name: default
        provider: velero.io/azure
        bucket: int-aks-we02
        config:
          storageAccount: intaksvelerobackups
          resourceGroup: int-aks-velero-backups-rg
          # subscriptionId: ***********
          # storageAccountURI: https://intaksvelerobackups.blob.core.windows.net
          # activeDirectoryAuthorityURI: https://login.microsoftonline.com/
          useAAD: "true"
    volumeSnapshotLocation:
      - name: default
        provider: velero.io/azure
        config:
          resourceGroup: MC_int-aks-we02-rg_int-aks-we02_westeurope
          # subscriptionId: ***********
          # incremental: true
          # activeDirectoryAuthorityURI: https://login.microsoftonline.com/

  credentials:
    secretContents:
      cloud: |
        AZURE_SUBSCRIPTION_ID=***********
        AZURE_RESOURCE_GROUP=MC_int-aks-we02-rg_int-aks-we02_westeurope
        AZURE_CLOUD_NAME=AzurePublicCloud

  nodeAgent:
    enabled: true

  rbac:
    create: true
    clusterAdministrator: true
    clusterAdministratorName: cluster-admin

  serviceAccount:
    server:
      create: true
      name: "int-aks-we02-velero-sa"
      annotations:
        azure.workload.identity/client-id: ***********

  initContainers:
    - name: velero-plugin-for-microsoft-azure
      image: velero/velero-plugin-for-microsoft-azure:v1.10.1
      volumeMounts:
        - mountPath: /target
          name: plugins

  podLabels:
    azure.workload.identity/use: "true"

  schedules:
    daily:
      schedule: "0 2 * * *"
      template:
        ttl: 1h0m0s
        includedNamespaces: []
        excludedNamespaces: []
        storageLocation: default

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.

anshulahuja98 commented 4 hours ago

@idanme-tr, can you share the permissions you have applied? And also your BSL configuration - does it have the storageAccountUri.

anshulahuja98 commented 8 minutes ago

Also I would recommend checking if you have any leftover of PodIdentity in your cluster. That often leads to issues