Question - Using Key-Vault in Azure Devops pipeline
I had Question for Using Key-Vault RBAC ( Role Based Access Control)
in Azure Devops pipeline.
- I created Key-Vault in Azure Portal with Azure RBAC ( Role Based Access Control)
- Also have added the Access Control (IAM) Policy - Key Vault Secrets User , Key Vault Secrets Officer , Key Vault Administrator for the Service Principal and my User-ID.
- In the Resource-Group - Added Key Vault Secrets User, Key Vault Administrator for the Service Principal and my User-ID.
- Created the Key and Secret.
- In Azure Devops YAML File for the below AzureKeyVault task, after running the Devops PipeLine getting the below Error.
- task: AzureKeyVault@2 inputs: azureSubscription: 'xxxxx' KeyVaultName: 'xxxx' SecretsFilter: '*' RunAsPreJob: true
- Error -
Downloading secrets using: https://azure-fabric-kv-test.vault.azure.net/secrets?maxresults=25&api-version=2016-10-01.
##[error]Get secrets failed. Error: Caller is not authorized to perform action on resource.
If role assignments, deny assignments or role definitions were changed recently, please observe propagation time.
Caller: appid=***;oid=XXX;iss=https://sts.windows.net/0xxxxxx/
Action: 'Microsoft.KeyVault/vaults/secrets/readMetadata/action'
Resource: '/subscriptions/4XXXXX/resourcegroups/XXXX/providers/microsoft.keyvault/vaults/XXXXX'
Assignment: (not found)
DenyAssignmentId: null
DecisionReason: null
Vault: aXXXXXX;location=eastus
. 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..
Uploading /home/vsts/work/1/ProvisionKeyVaultPermissions.ps1 as attachment
Finishing: AzureKeyVault