App Flex Consumption Args
Manages a Function App Running on a Flex Consumption Plan.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleAccount = new azure.storage.Account("example", {
name: "examplelinuxfunctionappsa",
resourceGroupName: example.name,
location: example.location,
accountTier: "Standard",
accountReplicationType: "LRS",
});
const exampleContainer = new azure.storage.Container("example", {
name: "example-flexcontainer",
storageAccountId: exampleAccount.id,
containerAccessType: "private",
});
const exampleServicePlan = new azure.appservice.ServicePlan("example", {
name: "example-app-service-plan",
resourceGroupName: example.name,
location: example.location,
skuName: "FC1",
osType: "Linux",
});
const exampleAppFlexConsumption = new azure.appservice.AppFlexConsumption("example", {
name: "example-linux-function-app",
resourceGroupName: example.name,
location: example.location,
servicePlanId: exampleServicePlan.id,
storageContainerType: "blobContainer",
storageContainerEndpoint: pulumi.interpolate`${exampleAccount.primaryBlobEndpoint}${exampleContainer.name}`,
storageAuthenticationType: "StorageAccountConnectionString",
storageAccessKey: exampleAccount.primaryAccessKey,
runtimeName: "node",
runtimeVersion: "20",
maximumInstanceCount: 50,
instanceMemoryInMb: 2048,
siteConfig: {},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_account = azure.storage.Account("example",
name="examplelinuxfunctionappsa",
resource_group_name=example.name,
location=example.location,
account_tier="Standard",
account_replication_type="LRS")
example_container = azure.storage.Container("example",
name="example-flexcontainer",
storage_account_id=example_account.id,
container_access_type="private")
example_service_plan = azure.appservice.ServicePlan("example",
name="example-app-service-plan",
resource_group_name=example.name,
location=example.location,
sku_name="FC1",
os_type="Linux")
example_app_flex_consumption = azure.appservice.AppFlexConsumption("example",
name="example-linux-function-app",
resource_group_name=example.name,
location=example.location,
service_plan_id=example_service_plan.id,
storage_container_type="blobContainer",
storage_container_endpoint=pulumi.Output.all(
primary_blob_endpoint=example_account.primary_blob_endpoint,
name=example_container.name
).apply(lambda resolved_outputs: f"{resolved_outputs['primary_blob_endpoint']}{resolved_outputs['name']}")
,
storage_authentication_type="StorageAccountConnectionString",
storage_access_key=example_account.primary_access_key,
runtime_name="node",
runtime_version="20",
maximum_instance_count=50,
instance_memory_in_mb=2048,
site_config={})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleAccount = new Azure.Storage.Account("example", new()
{
Name = "examplelinuxfunctionappsa",
ResourceGroupName = example.Name,
Location = example.Location,
AccountTier = "Standard",
AccountReplicationType = "LRS",
});
var exampleContainer = new Azure.Storage.Container("example", new()
{
Name = "example-flexcontainer",
StorageAccountId = exampleAccount.Id,
ContainerAccessType = "private",
});
var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
{
Name = "example-app-service-plan",
ResourceGroupName = example.Name,
Location = example.Location,
SkuName = "FC1",
OsType = "Linux",
});
var exampleAppFlexConsumption = new Azure.AppService.AppFlexConsumption("example", new()
{
Name = "example-linux-function-app",
ResourceGroupName = example.Name,
Location = example.Location,
ServicePlanId = exampleServicePlan.Id,
StorageContainerType = "blobContainer",
StorageContainerEndpoint = Output.Tuple(exampleAccount.PrimaryBlobEndpoint, exampleContainer.Name).Apply(values =>
{
var primaryBlobEndpoint = values.Item1;
var name = values.Item2;
return $"{primaryBlobEndpoint}{name}";
}),
StorageAuthenticationType = "StorageAccountConnectionString",
StorageAccessKey = exampleAccount.PrimaryAccessKey,
RuntimeName = "node",
RuntimeVersion = "20",
MaximumInstanceCount = 50,
InstanceMemoryInMb = 2048,
SiteConfig = null,
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/appservice"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
Name: pulumi.String("examplelinuxfunctionappsa"),
ResourceGroupName: example.Name,
Location: example.Location,
AccountTier: pulumi.String("Standard"),
AccountReplicationType: pulumi.String("LRS"),
})
if err != nil {
return err
}
exampleContainer, err := storage.NewContainer(ctx, "example", &storage.ContainerArgs{
Name: pulumi.String("example-flexcontainer"),
StorageAccountId: exampleAccount.ID(),
ContainerAccessType: pulumi.String("private"),
})
if err != nil {
return err
}
exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
Name: pulumi.String("example-app-service-plan"),
ResourceGroupName: example.Name,
Location: example.Location,
SkuName: pulumi.String("FC1"),
OsType: pulumi.String("Linux"),
})
if err != nil {
return err
}
_, err = appservice.NewAppFlexConsumption(ctx, "example", &appservice.AppFlexConsumptionArgs{
Name: pulumi.String("example-linux-function-app"),
ResourceGroupName: example.Name,
Location: example.Location,
ServicePlanId: exampleServicePlan.ID(),
StorageContainerType: pulumi.String("blobContainer"),
StorageContainerEndpoint: pulumi.All(exampleAccount.PrimaryBlobEndpoint, exampleContainer.Name).ApplyT(func(_args []interface{}) (string, error) {
primaryBlobEndpoint := _args[0].(string)
name := _args[1].(string)
return fmt.Sprintf("%v%v", primaryBlobEndpoint, name), nil
}).(pulumi.StringOutput),
StorageAuthenticationType: pulumi.String("StorageAccountConnectionString"),
StorageAccessKey: exampleAccount.PrimaryAccessKey,
RuntimeName: pulumi.String("node"),
RuntimeVersion: pulumi.String("20"),
MaximumInstanceCount: pulumi.Int(50),
InstanceMemoryInMb: pulumi.Int(2048),
SiteConfig: &appservice.AppFlexConsumptionSiteConfigArgs{},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.Container;
import com.pulumi.azure.storage.ContainerArgs;
import com.pulumi.azure.appservice.ServicePlan;
import com.pulumi.azure.appservice.ServicePlanArgs;
import com.pulumi.azure.appservice.AppFlexConsumption;
import com.pulumi.azure.appservice.AppFlexConsumptionArgs;
import com.pulumi.azure.appservice.inputs.AppFlexConsumptionSiteConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("examplelinuxfunctionappsa")
.resourceGroupName(example.name())
.location(example.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
.name("example-flexcontainer")
.storageAccountId(exampleAccount.id())
.containerAccessType("private")
.build());
var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
.name("example-app-service-plan")
.resourceGroupName(example.name())
.location(example.location())
.skuName("FC1")
.osType("Linux")
.build());
var exampleAppFlexConsumption = new AppFlexConsumption("exampleAppFlexConsumption", AppFlexConsumptionArgs.builder()
.name("example-linux-function-app")
.resourceGroupName(example.name())
.location(example.location())
.servicePlanId(exampleServicePlan.id())
.storageContainerType("blobContainer")
.storageContainerEndpoint(Output.tuple(exampleAccount.primaryBlobEndpoint(), exampleContainer.name()).applyValue(values -> {
var primaryBlobEndpoint = values.t1;
var name = values.t2;
return String.format("%s%s", primaryBlobEndpoint,name);
}))
.storageAuthenticationType("StorageAccountConnectionString")
.storageAccessKey(exampleAccount.primaryAccessKey())
.runtimeName("node")
.runtimeVersion("20")
.maximumInstanceCount(50)
.instanceMemoryInMb(2048)
.siteConfig(AppFlexConsumptionSiteConfigArgs.builder()
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleAccount:
type: azure:storage:Account
name: example
properties:
name: examplelinuxfunctionappsa
resourceGroupName: ${example.name}
location: ${example.location}
accountTier: Standard
accountReplicationType: LRS
exampleContainer:
type: azure:storage:Container
name: example
properties:
name: example-flexcontainer
storageAccountId: ${exampleAccount.id}
containerAccessType: private
exampleServicePlan:
type: azure:appservice:ServicePlan
name: example
properties:
name: example-app-service-plan
resourceGroupName: ${example.name}
location: ${example.location}
skuName: FC1
osType: Linux
exampleAppFlexConsumption:
type: azure:appservice:AppFlexConsumption
name: example
properties:
name: example-linux-function-app
resourceGroupName: ${example.name}
location: ${example.location}
servicePlanId: ${exampleServicePlan.id}
storageContainerType: blobContainer
storageContainerEndpoint: ${exampleAccount.primaryBlobEndpoint}${exampleContainer.name}
storageAuthenticationType: StorageAccountConnectionString
storageAccessKey: ${exampleAccount.primaryAccessKey}
runtimeName: node
runtimeVersion: '20'
maximumInstanceCount: 50
instanceMemoryInMb: 2048
siteConfig: {}
API Providers
This resource uses the following Azure API Providers:
Microsoft.Web
: 2023-12-01, 2023-01-01
Import
The Function Apps can be imported using the resource id
, e.g.
$ pulumi import azure:appservice/appFlexConsumption:AppFlexConsumption example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1
Constructors
Properties
One or more always_ready
blocks as defined below.
A map of key-value pairs for [App
A auth_settings
block as defined below.
An auth_settings_v2
block as defined below.
Should the function app use Client Certificates.
Paths to exclude when using client certificates, separated by ;
The mode of the Function App's client certificates requirement for incoming requests. Possible values are Required
, Optional
, and OptionalInteractiveUser
. Defaults to Optional
.
One or more connection_string
blocks as defined below.
A identity
block as defined below.
The memory size of the instances on which your app runs. The currently supported values are 2048
or 4096
.
The number of workers this function app can scale out to.
The name which should be used for this Function App. Changing this forces a new Function App to be created. Limit the function name to 32 characters to avoid naming collisions. For more information about Function App naming rule and Host ID Collisions
Should public network access be enabled for the Function App. Defaults to true
.
The name of the Resource Group where the Function App should exist. Changing this forces a new Linux Function App to be created.
The Runtime of the Linux Function App. Possible values are node
, dotnet-isolated
, powershell
, python
, java
and custom
.
The Runtime version of the Linux Function App. The values are diff from different runtime version. The supported values are 8.0
, 9.0
for dotnet-isolated
, 20
for node
, 3.10
, 3.11
for python
, 11
, 17
for java
, 7.4
for powershell
.
The ID of the App Service Plan within which to create this Function App. Changing this forces a new Linux Function App to be created.
A site_config
block as defined below.
A sticky_settings
block as defined below.
The access key which will be used to access the backend storage account for the Function App.
The authentication type which will be used to access the backend storage account for the Function App. Possible values are StorageAccountConnectionString
, SystemAssignedIdentity
, and UserAssignedIdentity
.
The backend storage container endpoint which will be used by this Function App.
The storage container type used for the Function App. The current supported type is blobContainer
.
The user assigned Managed Identity to access the storage account. Conflicts with storage_access_key
.
Should the default WebDeploy Basic Authentication publishing credentials enabled. Defaults to true
.
The local path and filename of the Zip packaged application to deploy to this Linux Function App.