Description
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
HelmDeploy
Task version
1
Issue Description
Summary
The HelmDeploy@1 task with connectionType: 'Azure Resource Manager'
correctly authenticates to Azure using the specified service connection but then uses a different identity (the ado project identity) when performing Kubernetes operations, ignoring the service connection's identity that has been granted appropriate Kubernetes RBAC permissions.
Environment
- Azure DevOps Hosted Agent (Ubuntu)
- HelmDeploy@1 version: 1.256.0
- AKS with Entra ID (Azure AD) integration enabled
- Service Connection using Workload Identity Federation
Steps to Reproduce
- Create an AKS cluster with Entra ID integration
- Create a service connection with Workload Identity Federation
- Grant the service connection's service principal appropriate Kubernetes RBAC permissions
- Use HelmDeploy@1 task with the service connection:
- task: HelmDeploy@1
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: 'my-service-connection'
azureResourceGroup: 'my-resource-group'
kubernetesCluster: 'my-aks-cluster'
namespace: 'my-namespace'
command: 'upgrade'
chartName: 'my-chart'
releaseName: 'my-release'
Expected Behavior
The task should use the service connection's identity (which has proper Kubernetes RBAC permissions) for all Kubernetes operations.
Actual Behavior
The task:
- Successfully authenticates to Azure using the service connection (verified in logs)
- Successfully retrieves kubeconfig via
listClusterUserCredential
API - BUG: Uses a different identity for Kubernetes operations, resulting in RBAC errors
##[debug]774094b1-d28f-4707-82d2-bdad7e4f4f8f auth param serviceprincipalid = ***
##[debug]Using msalv2
##[debug]774094b1-d28f-4707-82d2-bdad7e4f4f8f auth scheme = WorkloadIdentityFederation
Logs
[command]/azp/_tool/helm/3.18.3/x64/linux-amd64/helm upgrade --namespace wms-tasks-dev --install --values /azp/5/a/build-artifacts/azure/releases/dev-values.yaml --set image.buildNumber=20250617.4 --wait wms-tasks-dev oci://***/helm/dot-net-multi-host-app
Error: query: failed to query with labels: secrets is forbidden: User "c00f74a9-9758-423d-b855-5dd222e90d8e" cannot list resource "secrets" in API group "" in the namespace "wms-tasks-dev"
The error shows a different service principal ID (c00f74a9-9758-423d-b855-5dd222e90d8e
) than the one specified in the service connection.
Impact
This bug prevents teams from using service connections with properly scoped Kubernetes RBAC permissions. It forces users to either:
- Grant permissions to an identity they don't control
- Use
useClusterAdmin: true
(security risk) - Abandon the task and use custom scripts
Root Cause Analysis
The task appears to use listClusterUserCredential
which returns a generic kubeconfig instead of one authenticated with the service connection's identity. When using Entra ID integration, the task should ensure the kubeconfig uses the service connection's identity for Kubernetes authentication.
Suggested Fix
When connectionType: 'Azure Resource Manager'
is used with an Entra ID-enabled AKS cluster:
- The task should configure kubelogin to use the service connection's identity
- Or provide an option to specify the authentication method (workloadidentity, spn, etc.)
- At minimum, document this limitation clearly
15_Deploy Helm Chart (Azure Resource Manager).txt
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu 22.04
Relevant log output
2025-06-17T17:36:42.1999142Z ##[error]Error: query: failed to query with labels: secrets is forbidden: User "c00f74a9-9758-423d-b855-5dd222e90d8e" cannot list resource "secrets" in API group "" in the namespace "wms-tasks-dev": User does not have access to the resource in Azure. Update role assignment to allow access.
Full task logs with system.debug enabled
2025-06-17T17:36:42.2000289Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=9fb999ee-99a3-4b7e-a71c-7fbb462fb0dd;]Error: query: failed to query with labels: secrets is forbidden: User "c00f74a9-9758-423d-b855-5dd222e90d8e" cannot list resource "secrets" in API group "" in the namespace "wms-tasks-dev": User does not have access to the resource in Azure. Update role assignment to allow access.
2025-06-17T17:36:42.2002801Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: query: failed to query with labels: secrets is forbidden: User "c00f74a9-9758-423d-b855-5dd222e90d8e" cannot list resource "secrets" in API group "" in the namespace "wms-tasks-dev": User does not have access to the resource in Azure. Update role assignment to allow access.
2025-06-17T17:36:42.2003891Z ##[debug]connectionType=Azure Resource Manager
2025-06-17T17:36:42.2006225Z ##[section]Finishing: Deploy Helm Chart (Azure Resource Manager)