Use WEBSITE_RUN_FROM_PACKAGE in azure functions for deployment #246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Azure Storage File Share doesn’t currently support managed identities. This is used by the
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
environment variable and is required for azure functions that use a consumption plan.There is a work around to use
WEBSITE_RUN_FROM_PACKAGE
where one needs to upload the azure function zip package into an storage account that is accessible to the function app. The main downside is that there is a 15 seconds cold start.For this to work the release needs to be modified to not use the AzFunc deploy task as it is not supported. We have a task group that is specialized in azure function deployment. I modified that task with the following.
$(Release.ReleaseName)-$(Release.AttemptNumber).zip
name to keep it unique.WEBSITE_RUN_FROM_PACKAGE
to the full url of the blob in the container. For this, I'm taking advantage of the multiple parameter files deployment to dynamically generate a parameters file with the newrunFromPackageUrl
parameter by deserializingazurefunction.deployment.json
and setting the full url at release time. Then is just passing that file a another paramater fileWith these we completely remove the need to use access keys in the storage accounts used for azure functions.
I also moved away from app registrations to user assigned managed identities for deployment.