How to deploy Azure Functions code

Hi everbody,

i am a little confused on how to deploy a function app properly with ZIP deployment.
Currently I have:

    const asset = new TerraformAsset(this, 'function-asset', {
      path: resolve(__dirname, 'dist/'),
      type: AssetType.ARCHIVE,

    new StorageBlob(this, 'appcode', {
      name: '',
      type: 'block',
      source: asset.path,
    const sp = new AppServicePlan(this, 'appSp', {
      location: rg.location,
      name: 'cdktf-app-service-plan',
      sku: [{ size: 'Y1', tier: 'Dynamic' }],
      kind: 'FunctionApp',
    new FunctionApp(this, 'faId', {
      location: rg.location,
      name: 'cdktf-fa-name',
      storageAccountAccessKey: sa.primaryAccessKey,
      version: '~3',

but how can the StorageBlob be linked to the function app? Normaly ou would like to do a so called ZIP deployment and set the appsettingof the function to WEBSITE_RUN_FROM_PACKAGE=1 to increase startup time on windows etc.
Does anybody have an exampe for azure, I only can find examples for AWS Lambda.

Thanks a lot


Hey there,

As a disclaimer, I have never worked with Azure. I found this article, outlining how it works with Terraform, they suggest setting appsettings.WEBSITE_RUN_FROM_PACKAGE to a certain value. In CDKTF this would look like this:

const sas = new DataAzurermStorageAccountSas(this, "sas", {
  expiry: "2021-12-31",
  httpsOnly: true,
  permissions: [
      add: false,
      create: false,
      delete: false,
      list: false,
      process: false,
      read: true,
      update: false,
      write: false,
  resourceTypes: [
      container: false,
      object: true,
      service: false,
  services: [
      blob: true,
      file: false,
      queue: false,
      table: false,
  start: "2019-01-01",

new FunctionApp(this, "faId", {
  // ...
  appSettings: {
    WEBSITE_RUN_FROM_PACKAGE: `https://${}${}/${}${}`,
  version: "~3",

Hope this helps :slight_smile:

Hey @DanielMSchmidt,

thanks a lot for the help! I found that article too, it would be a possible solutions but apparently it has some drawbacks in regards to performance and startup time of the function. I will evaluate it, but I fear I will need some Scripts to deploy via Azure CLI, I have the feeling that it is anyway a Azure deployment issue, because AWS Lambda is way easier and more natural to deploy.

But again, thanks for the coding

Best regards