Reputation: 699
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: 'vvkstaccforflexfuncapp'
location: 'uksouth'
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
properties: {
accessTier: 'Hot'
minimumTlsVersion: 'TLS1_2'
}
}
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
name: 'name'
location: 'uksouth'
kind: 'web'
properties: {
Application_Type: 'web'
}
}
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2019-11-01' = {
name: 'vnetforflexfuncapp'
location: 'uksouth'
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/16'
]
}
subnets: [
{
name: 'InboundSubnet'
properties: {
addressPrefix: '10.0.0.0/24'
}
}
{
name: 'OutboundSubnet'
properties: {
addressPrefix: '10.0.1.0/24'
}
}
]
}
}
resource flexappserviceplan 'Microsoft.Web/serverfarms@2024-04-01' = {
name: 'vscodeflexappserviceplan'
location: 'uksouth'
sku: {
name: 'FC1'
tier: 'FlexConsumption'
family: 'FC'
capacity: 0
}
kind: 'functionapp'
}
resource flexfunapp 'Microsoft.Web/sites@2024-04-01' = {
name: 'vscodeflexfunapp'
location: 'uksouth'
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/subscriptionid/resourceGroups/vivekchak-rg/providers/Microsoft.Network/virtualNetworks/vnetforflexfuncapp/subnets/OutboundSubnet'
}
}
resource privateEndpoint1 'Microsoft.Network/privateEndpoints@2024-05-01' = {
name: flexfunapp.name
location: 'uksouth'
properties: {
subnet: {
id: '/subscriptions/<subscriptionid>/resourceGroups/vivekchak-rg/providers/Microsoft.Network/virtualNetworks/vnetforflexfuncapp/subnets/InboundSubnet'
}
privateLinkServiceConnections: [
{
name: 'flexfunapp'
properties: {
privateLinkServiceId: flexfunapp.id
groupIds: [
'blob'
]
}
}
]
}
}
I have followed all the given limitations and instructions given in this MS Doc but I'm unable to deploy the flex consumption plan function app.
Requested features are not supported in region. Please try another region. (Code:)
Here What I'm doing is:
Upvotes: 0
Views: 174
Reputation: 166
Please ensure that you follow this for the plan creation:
resource flexFuncPlan 'Microsoft.Web/serverfarms@2024-04-01' = {
name: planName
location: location
tags: tags
kind: 'functionapp'
sku: {
tier: 'FlexConsumption'
name: 'FC1'
}
properties: {
reserved: true
}
}
Here's a full example: https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/blob/main/IaC/bicep/core/host/function.bicep
Upvotes: 2
Reputation: 1
Your problem seems to be in the service plan properties. If I add these properties, it works (I'm not sure why they have to be there).
resource flexappserviceplan 'Microsoft.Web/serverfarms@2024-04-01' = {
name: 'nottakensp213'
location: 'uksouth'
sku: {
name: 'FC1'
tier: 'FlexConsumption'
size: 'FC1'
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
}
}
I would recommend to set up everything in the portal first, then export the arm template (can be converted to bicep in vscode) and use the generated one as a reference (in my opinion it generates a lot of unnecessary stuff, but it can help you in case of problems)
Upvotes: 0