Skip to main content

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 (granted AcrPull).
  • 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_PACKAGE to that blob. The runtime stack comes from applicationStack. A storageAccountConnectionString is required for the zip path.

TypeScript SDK​

A function is split across the two levels like every other component. The blueprint declares an abstract Function and governs the vendor-neutral parameters; the Live System selects the AzureFunction offer.

1. Declare the Function in the blueprint​

import {createFractal, Function} from '@fractal_cloud/sdk/model';

export const fractal = createFractal({
id: 'orders',
version: {major: 1, minor: 0, patch: 0},
description: 'Orders processing function.',
boundedContextId: {
ownerType: 'Personal',
ownerId: process.env['OWNER_ID']!,
name: 'reusable-templates',
},
blueprint: bp => {
const orders = bp.add(
Function({id: 'orders-fn', displayName: 'Orders Function'})
.withRuntime('java17') // guardrail — the runtime stack
.withMemory(512) // guardrail: MB
.withTimeout(30) // guardrail: seconds
.withEnvironment({LOG_LEVEL: 'INFO'}),
);
return {orders};
},
operations: s => ({
/** The artefact the application ships. */
withArtifact: (uri: string) => s.orders.set('sourceArtifact', uri),
}),
});

withRuntime, withMemory, withTimeout, withConcurrency and withEnvironment are vendor-neutral and identical on every cloud — the same blueprint satisfies an AWS Lambda or a Cloud Run function without editing. withEnvironment is what becomes the Function App's app settings.

2. Select the Azure Function offer in the Live System​

import {AzureFunction} from '@fractal_cloud/sdk/model';

const liveSystem = fractal
.specialize()
.withArtifact('myacr.azurecr.io/orders-fn:1.4.0')
.toLiveSystem({
name: 'orders-dev',
environment,
select: {
'orders-fn': AzureFunction({region: 'westeurope'}),
},
});

For a container-image Function App, point the artefact at an ACR image instead of a zip — nothing else changes. The agent detects the package type from the artefact and runs an image on a Linux container plan, pulling it with the app's managed identity.

Storage account connection

The zip path needs a storage account connection string, but the AzureFunction offer takes only region — there is no parameter to supply one, so the environment's own storage provides it.

Do not try to pass it as a Live System parameter, and never inline a connection string anywhere in a blueprint. Where a component parameter or link setting does need a secret, reference it by short name with secretRef('<shortName>') so the raw value stays in the environment secret store — see environment-secret references. Offer config is not one of those places.

See the Component Reference for every parameter the offer accepts, and Core API for the authoring surface.