Azure Functions
This page shows how to deploy an Azure Function from an OCI artefact using the Fractal SDK.
For the artefact contract and prerequisites, see the main guide.
How the agent deploys
The Azure Function offer reads sourceArtifact and picks the Azure-native path:
- Container image artefact → the Function App runs as a Linux container (
linuxFxVersion = DOCKER|<image>) and pulls the image from your ACR using the app's managed identity (grantedAcrPull). - Zip artefact → the agent pulls the zip, stages it to a blob it owns in the function's storage account, and sets
WEBSITE_RUN_FROM_PACKAGEto that blob. The runtime stack comes fromapplicationStack. AstorageAccountConnectionStringis required for the zip path.
TypeScript SDK
import {AzureFunction} from '@fractal_cloud/sdk';
// Zip artefact: runtime stack via applicationStack; storage connection required.
const ordersFn = AzureFunction.create({
id: 'orders-fn',
version: {major: 1, minor: 0, patch: 0},
displayName: 'Orders Function',
sourceArtifact: 'myacr.azurecr.io/orders-fn:1.4.0',
applicationStack: {javaVersion: '17'},
storageAccountConnectionString:
'DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...',
appSettings: {LOG_LEVEL: 'INFO'},
});
For a container-image Function App, point sourceArtifact at an ACR image (the agent runs it on a Linux container plan with managed-identity pull):
const imageFn = AzureFunction.create({
id: 'orders-fn',
version: {major: 1, minor: 0, patch: 0},
displayName: 'Orders Function',
sourceArtifact: 'myacr.azurecr.io/orders-fn:1.4.0',
packageType: 'image',
});
Satisfying a blueprint Function
import {Function, AzureFunction} from '@fractal_cloud/sdk';
const fn = Function.create({
id: 'orders-fn',
version: {major: 1, minor: 0, patch: 0},
displayName: 'Orders Function',
sourceArtifact: 'myacr.azurecr.io/orders-fn:1.4.0',
});
const azureFn = AzureFunction.satisfy(fn.component)
.withApplicationStack({javaVersion: '17'})
.withStorageAccountConnectionString(
'DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...',
)
.build();