Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureFunctionApp does not work with storage account key vault reference and linux consumption plan #16749

Open
cveld opened this issue Aug 17, 2022 · 11 comments

Comments

@cveld
Copy link

cveld commented Aug 17, 2022

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: AzureFunctionApp

list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzureFunctionAppV1
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzureFunctionAppV2
Interestingly, v2 does not seem to be published to the market place?

Environment

  • Azure Pipelines

    • If using Azure Pipelines, provide the account name, team project name, build definition name/build number: I can disclose this information through private channels

Issue Description

When deploying a function app to a linux consumption plan hosted function app service with a key vault reference in the property AzureWebJobsStorage, the task will fail with the error message: Unable to find the storage account associated with the function app.
Value I am using: @Microsoft.KeyVault(VaultName=myvault;SecretName=mystorageaccount-ConnectionString)

Interestingly deploying through Visual Studio 2022 (17.2) works fine.
func cli fails; version 4.0.4590 with the error Error creating a Blob container reference. Please make sure your connection string in "AzureWebJobsStorage" is valid. For this it appears there is already an issue opened: Azure/azure-functions-core-tools#2564

Task logs

I can disclose this through private channels

@bennycoomans
Copy link

I have the same issue. For now, I resorted to setting the connection string directly for the AzureWebJobsStorage key, instead of using a key vault reference. However, this feels less secure, so it would be great if this could be fixed.

@nadesu , this issue has been auto-assigned to you, would you play a role in addressing this issue and if so, do you have any idea if this will be fixed somewhere in the (near or distant) future?

@FinVamp1 FinVamp1 assigned FinVamp1 and unassigned nadesu Dec 7, 2022
@FinVamp1
Copy link
Contributor

FinVamp1 commented Dec 7, 2022

Hi, I will test this soon and come back to this work item and update you.

@databrickstrainer
Copy link

Any update on this issue? It seems like it's still a problem...

@FinVamp1
Copy link
Contributor

Hi, still thinking about how best to implement this. Would you be happy to add the Service Principal directly and manually to the Key Vault to enable this functionality?

@cveld
Copy link
Author

cveld commented Mar 19, 2023

Which service principal?

  • ideally we should be leveraging managed identity. The function app MI should have the appropriate azure rbac permissions onto the storage account
  • when using connectionstring stored in a key vault secret as a fallback, the function app MI should have appropriate rbac permissions on the key vault secret. Like the other settings work.

In both cases this should be done upfront before running the azure pipelines task.

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Sep 16, 2023
@bennycoomans
Copy link

bennycoomans commented Sep 16, 2023

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

I don't think this issue should be closed.

@github-actions github-actions bot removed the stale label Sep 16, 2023
@Saulopv
Copy link

Saulopv commented Dec 5, 2023

This is still a problem for me, not stale.

@af-mst
Copy link

af-mst commented Jan 17, 2024

Has there be any progress? We moved all access to Storage Sccounts to RBAC, for the deployments we still have to have the Storage Connectionstring in the portal settings under AzureWebJobsStorage :(

@FinVamp1 FinVamp1 added FunctionsTaskBacklog and removed environment:need-to-triage Issues need to be triage by environment-deployment team labels Feb 6, 2024
@reubano
Copy link

reubano commented Mar 21, 2024

Same issue. I found this SO answer that claims to have gotten it to work by setting appSettings in the pipeline yaml. I haven't been able to reproduce though.

@gudbrand3
Copy link

gudbrand3 commented May 31, 2024

I have had the same issue and after a lot of digging found this post. I'm experiencing the same, actually the same issue for both

  • Function App - Linux - Consumption plan
  • Function App - Windows - Consumption plan

The;

  • WEBSITE_CONTENTAZUREFILECONNECTIONSTRING resolves correctly to keyvault
  • AzureWebJobsStorage does not resolve to keyvault and fails. Setting the connection string to the same value as the keyvault secret using ARM makes it work (no keyvault..)

I have tested det SO answer @reubano for both cases Linux and Windows but couldn't get it working so I'm not sure but have my doubts, it says nothing about which app plan is been used as far as I can tell, so might not be consumption based.

To me it seems like a clear limitation/bug of consumption based app plans and something Microsoft should address giving they say best practice is to use keyvault for secrets. it cant be 90%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants