I am configuring an Azure DevOps pipeline environment check of type "Invoke Azure Function". I am using a pipeline variable group in order to reference the function key value as a variable. The variable group has been created from a connected key vault in Azure. When I run the pipeline to trigger the check function, it returns a 401 and I can see from the function logs (no output at all) and the pipeline "response:0" that the function was not invoked. The function key is not getting passed to the function and the call is denied. I further tested this theory by hard coding the function key into the set-up form, instead of using a variable, and the function triggered and ran as expected.
Further details:
Has anyone experienced this issue and found a solution? Other testing ideas also welcome. Thanks in advance.
Edit: I have attached the pipeline check configuration, 401 error and the simple pipeline I created in the same project to test connection to the Azure key vault.
Invoke Azure Function Config1Invoke Azure Function Config2
401 error when pipeline check tries to trigger the function pipeline used in separate repo to test DevOps access to the key vault
Edit 2 (In response to the bot asking for ways to reproduce the error)
Create:
Your DevOps identity and Function will need GET and LIST permissions on secrets to access the azure key vault.
Set up a pipeline check "Invoke Azure Function" through the "Approvals and checks" tab on the pipeline environment page.
The function working and pipeline code is irrelevant. The issue is: I cannot seem to trigger the function using a variable group linked to an azure key vault. A function key hard coded into the form triggers the function, but not the variable in the form $(myVariable).
I can reproduce the same issue when using the Secret variable from Azure Key Vault(Variable Group).
I am afraid that Invoke function App task doesn't support using the secret from Azure Key Vault Variable group.
When we use the Azure Key Vault Variable in Agent job, it will add step to download the key vault first, then we can use it in Agent job.
But the Invoke Function App task is using Agentless job, it doesn't support downloading the Azure Key Vault secret. We are not able to using Azure Key Vault directly without downloading it.
So it doesn't support using the Azure Key Vault Secret.
For a workaround, you can directly define the Function Key as secret variable in Variable group.
For example:
Then we can use the secret variable in Invoke Function App task.
Result: