Flex Consumption pricing tier is not enabled for this subscription

Rajoli Hari Krishna 576 Reputation points
2025-01-04T16:26:33.3033333+00:00

HI Microsoft Azure Team,

Greetings for the day and Wish you a happy new year.

I'm deploying the Azure Function App in Flex Consumption Model. Using the Portal, I'm able to deploy it successfully but using the bicep code deployment, getting an error as shown below:

Error:

New-AzResourceGroupDeployment: 9:41:52 PM - The deployment 'FlexFuncAppDeployment' failed with error(s). Showing 1 out of 1 error(s).
Status Message: Flex Consumption pricing tier is not enabled for this subscription. (Code: BadRequest)
 - Flex Consumption pricing tier is not enabled for this subscription. (Code:)
 -  (Code:BadRequest)
 -  (Code:)

Bicep Code:

resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' existing = {
  name: 'vvkstaccforflexfuncapp'
}

resource appInsights 'Microsoft.Insights/components@2020-02-02' existing = {
  name: 'vvkappinsightsforfuncapp'
}

resource flexappserviceplan 'Microsoft.Web/serverfarms@2024-04-01' = {
  name: 'vscodeflexappserviceplan'
  location:  'West US'
  sku: {
    name: 'FC1'
    tier: 'FlexConsumption'
    family: 'FC'
    capacity: 0
  }
  kind: 'functionapp'
  properties: {
    perSiteScaling: false
    elasticScaleEnabled: false
    maximumElasticWorkerCount: 1
    isSpot: false
    reserved: true
    isXenon: false
    hyperV: false
    targetWorkerCount: 0
    targetWorkerSizeId: 0
    zoneRedundant: false
  }
}

resource flexfunapp 'Microsoft.Web/sites@2024-04-01' = {
  name: 'vscodeflexfunapp'
  location: 'West US'
  kind: 'functionapp,linux'
  properties: {
    serverFarmId: flexappserviceplan.id
    siteConfig: {
      appSettings: [
        {
          name: 'AzureWebJobsStorage__accountName'
          value: storageAccount.name
        }
        {
          name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
          value: appInsights.properties.ConnectionString
        }
      ]
      numberOfWorkers: 1
    }
    functionAppConfig: {
      deployment: {
        storage: {
          type: 'blobcontainer'
          value: '${storageAccount.properties.primaryEndpoints.blob}container'
          authentication: {
            type: 'SystemAssignedIdentity'
          }
          
        }
      }
      scaleAndConcurrency: {
        maximumInstanceCount: 100
        instanceMemoryMB: 4096
      }
      runtime: {
        name: 'python'
        version: '3.11'
      }
    }
    httpsOnly: true
    publicNetworkAccess: 'Disabled'
    virtualNetworkSubnetId: '/subscriptions/<azure-subscription-id>/resourceGroups/vivekchak-rg/providers/Microsoft.Network/virtualNetworks/vnetforflexfuncapp/subnets/OutboundSubnet'    
  }
}



Following this MS Documentation, I have done the below things:

  1. Removed deprecated properties and used the required only.
  2. Creating the Function App with public network access disabled and enabling the virtual network integration.

Could you please assist me.

Thanks in Advance.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,278 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.