Hi Hitesh N
Could you please try the below steps to resolve this issue:
- Ensure that the Service Principal used in your Azure DevOps service connection has the correct permissions on the Key Vault. It needs to have at least the GET and LIST permissions.
- Navigate to KeyVaults -> Your Keyvault -> Access Configuration -> Permission Policy - Select Vault access policy -> Go to Access policies, add the Azure DevOps service principal with Get and List secret permissions.
- In Azure DevOps, go to Project Settings > Service connections. Select the service connection you are using for Azure Key Vault. Ensure that the connection is valid and that it uses the correct Service Principal credentials.
- Now, navigate to your Azure key vault. -> Access Control (IAM) -> Click add role assignment -> Select Key Vault Secrets User -> Click next -> Select Members -> Look for your Service Principal -> Review + Assign. And then, click Authorize again in DevOps.
- Please refer to this doc: Using secrets from Azure Key Vault in a pipeline
You can also try to create a Variable Group in Azure DevOps:
- In Azure DevOps, go to Pipelines -> Library -> Click + Variable Group -> Select Link secrets from an Azure Key Vault as variables and select your subscription and the Key Vault -> Save.
- Now, use Variable Group in Pipeline:
- In your YAML file, add a reference to the group name:
variables: - group: my-variable-group
- In your YAML file, add a reference to the group name:
Additional References:
Hope this helps!
Please Let me know if you have any queries.