-
Notifications
You must be signed in to change notification settings - Fork 52
Custom Extension Bundle
Naren Soni edited this page Apr 26, 2022
·
2 revisions
You may need to create a custom version of extension bundle for number of scenarios. This page walks through the process of creating an extension bundle with an id of your choosing.
- Azure storage account with blob endpoint
- Azure.Storage module for powershell
- Choose a base branch from the bundle repo that you want use to generate your bundle.
- Clone the branch and follow the build steps for the respective branch. For this example we would use branch v2.x
- Build the branch to confirm your build setup works as expected.
- Update the Bundle id and version property to the custom id and version in bundleConfig.json file to match your expectations. Extension bundle follows NuGet package versioning scheme. Checkout this page for more information in versioning schema
- Build again to confirm the changes took effect
- Follow the steps here to add remove an extension
Azure Functions downloads the configured extension bundle based on host.json configuration. This would mean that for custom extension bundle to work you would need to override the default bundle source endpoint with a your own. The steps in this sections walks you through the process of creating such and endpoint and uploading bundle artifacts to one.
- Create an Azure Storage account that is capable of hosting blobs.
- Create a container with name "public"
- Set the public access level to "Blob (anonymous read access for blobs only)"
- Once the bundle is generated. Locate the artifacts directory at the root of the repo.
- Run the following commands to upload the extension bundle to the storage account.
# Azure.Storage module is required to run script below
cd tools
.\uploadToStorage.ps1 -StorageAccountName "<AccountName>" -StorageAccountKey "StorageAccountKey" -bundleId "BundleId"
- Delete the extensions bundle directory at
/Users/<user>/.azure-functions-core-tools
or%userprofile%\.azure-functions-core-tools
- Set the environment variable
FUNCTIONS_EXTENSIONBUNDLE_SOURCE_URI=https://<storageAccountName>.blob.core.windows.net/public
- Set host.json to
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[<bundleVersion>,<nextMajorversion>)" // Sample: "version": "[2.9.1,3.0.0)".
// By default this value is always a range. A single verison number is still considered as version range.
// "version": "2.9.1" would mean >= 2.9.1
}
}