TL&DR - My DevOps release pipeline keeps failing with 'does not have secrets list permission on key vault
I am stumped with this one, and asking for help, please.
The Error
2023-06-07T07:12:53.7594988Z ##[error]Get secrets failed. Error: The user, group or application 'appid=***;oid=b5a[REDACTED];iss=https://sts.windows.net/292[REDACTED]/' does not have secrets list permission on key vault 'kv-d-chatgeni;location=australiasoutheast'. For help resolving this issue, please see https://go.microsoft.com/fwlink/?linkid=2125287. The specified Azure service connection needs to have Get, List secret management permissions on the selected key vault. To set these permissions, download the ProvisionKeyVaultPermissions.ps1 script from build/release logs and execute it, or set them from the Azure portal..
Data
The service principle for devops is
| Object | Value |
|---|---|
| Application (client) ID | 14e[REDACTED] |
| Object ID | a7e[REDACTED] |
| Application (client) ID | 292[REDACTED] |
I noticed that the Object ID in KeyVault is b5a[REDACTED], but same Application (client) ID
I ran the following command on the Object ID reported
az role assignment create --role "Key Vault Secrets User" --assignee b5a[REDACTED] --scope /subscriptions/ade[REDACTED]
I even tried with the Application ID of the Service Principle as I noticed that Access Policies use the Application ID
az role assignment create --role "Key Vault Secrets User" --assignee 14e[REDACTED] --scope /subscriptions/143[REDACTED]
My Tenant ID: 292\[REDACTED\]
TASK
steps:
- task: AzureKeyVault@2
displayName: 'Azure Key Vault: kv-d-[REDACTED]'
inputs:
azureSubscription: 'app-[REDACTED]'
KeyVaultName: 'kv-d-[REDACTED]'
RunAsPreJob: true
Other
- I have given Contributor Role on subscription to b5a[REDACTED]
- My KeyVault is set to use RBAC
- I created another test KeyVault with Access Policies, and gave object List, Get permissions. It worked fine in the build pipeline, unfortunatly our production environment uses RBAC.
I am stumped. I have read tons of posts, many are Access Policy driven. The RBAC ones are vague and ambiguous.
I am stumped. I have read tons of posts, many are Access Policy driven. The RBAC ones are vague and ambiguous.




