We recommend using Azure Native.
azure.appservice.FunctionAppFunction
Explore with Pulumi AI
Manages a Function App Function.
Example Usage
Basic HTTP Trigger
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
    name: "example-group",
    location: "West Europe",
});
const exampleAccount = new azure.storage.Account("example", {
    name: "examplesa",
    resourceGroupName: example.name,
    location: example.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const exampleServicePlan = new azure.appservice.ServicePlan("example", {
    name: "example-service-plan",
    location: example.location,
    resourceGroupName: example.name,
    osType: "Linux",
    skuName: "S1",
});
const exampleLinuxFunctionApp = new azure.appservice.LinuxFunctionApp("example", {
    name: "example-function-app",
    location: example.location,
    resourceGroupName: example.name,
    servicePlanId: exampleServicePlan.id,
    storageAccountName: exampleAccount.name,
    storageAccountAccessKey: exampleAccount.primaryAccessKey,
    siteConfig: {
        applicationStack: {
            pythonVersion: "3.9",
        },
    },
});
const exampleFunctionAppFunction = new azure.appservice.FunctionAppFunction("example", {
    name: "example-function-app-function",
    functionAppId: exampleLinuxFunctionApp.id,
    language: "Python",
    testData: JSON.stringify({
        name: "Azure",
    }),
    configJson: JSON.stringify({
        bindings: [
            {
                authLevel: "function",
                direction: "in",
                methods: [
                    "get",
                    "post",
                ],
                name: "req",
                type: "httpTrigger",
            },
            {
                direction: "out",
                name: "$return",
                type: "http",
            },
        ],
    }),
});
import pulumi
import json
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
    name="example-group",
    location="West Europe")
example_account = azure.storage.Account("example",
    name="examplesa",
    resource_group_name=example.name,
    location=example.location,
    account_tier="Standard",
    account_replication_type="LRS")
example_service_plan = azure.appservice.ServicePlan("example",
    name="example-service-plan",
    location=example.location,
    resource_group_name=example.name,
    os_type="Linux",
    sku_name="S1")
example_linux_function_app = azure.appservice.LinuxFunctionApp("example",
    name="example-function-app",
    location=example.location,
    resource_group_name=example.name,
    service_plan_id=example_service_plan.id,
    storage_account_name=example_account.name,
    storage_account_access_key=example_account.primary_access_key,
    site_config={
        "application_stack": {
            "python_version": "3.9",
        },
    })
example_function_app_function = azure.appservice.FunctionAppFunction("example",
    name="example-function-app-function",
    function_app_id=example_linux_function_app.id,
    language="Python",
    test_data=json.dumps({
        "name": "Azure",
    }),
    config_json=json.dumps({
        "bindings": [
            {
                "authLevel": "function",
                "direction": "in",
                "methods": [
                    "get",
                    "post",
                ],
                "name": "req",
                "type": "httpTrigger",
            },
            {
                "direction": "out",
                "name": "$return",
                "type": "http",
            },
        ],
    }))
package main
import (
	"encoding/json"
	"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-group"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
			Name:                   pulumi.String("examplesa"),
			ResourceGroupName:      example.Name,
			Location:               example.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
			Name:              pulumi.String("example-service-plan"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			OsType:            pulumi.String("Linux"),
			SkuName:           pulumi.String("S1"),
		})
		if err != nil {
			return err
		}
		exampleLinuxFunctionApp, err := appservice.NewLinuxFunctionApp(ctx, "example", &appservice.LinuxFunctionAppArgs{
			Name:                    pulumi.String("example-function-app"),
			Location:                example.Location,
			ResourceGroupName:       example.Name,
			ServicePlanId:           exampleServicePlan.ID(),
			StorageAccountName:      exampleAccount.Name,
			StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
			SiteConfig: &appservice.LinuxFunctionAppSiteConfigArgs{
				ApplicationStack: &appservice.LinuxFunctionAppSiteConfigApplicationStackArgs{
					PythonVersion: pulumi.String("3.9"),
				},
			},
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"name": "Azure",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		tmpJSON1, err := json.Marshal(map[string]interface{}{
			"bindings": []interface{}{
				map[string]interface{}{
					"authLevel": "function",
					"direction": "in",
					"methods": []string{
						"get",
						"post",
					},
					"name": "req",
					"type": "httpTrigger",
				},
				map[string]interface{}{
					"direction": "out",
					"name":      "$return",
					"type":      "http",
				},
			},
		})
		if err != nil {
			return err
		}
		json1 := string(tmpJSON1)
		_, err = appservice.NewFunctionAppFunction(ctx, "example", &appservice.FunctionAppFunctionArgs{
			Name:          pulumi.String("example-function-app-function"),
			FunctionAppId: exampleLinuxFunctionApp.ID(),
			Language:      pulumi.String("Python"),
			TestData:      pulumi.String(json0),
			ConfigJson:    pulumi.String(json1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-group",
        Location = "West Europe",
    });
    var exampleAccount = new Azure.Storage.Account("example", new()
    {
        Name = "examplesa",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
    });
    var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
    {
        Name = "example-service-plan",
        Location = example.Location,
        ResourceGroupName = example.Name,
        OsType = "Linux",
        SkuName = "S1",
    });
    var exampleLinuxFunctionApp = new Azure.AppService.LinuxFunctionApp("example", new()
    {
        Name = "example-function-app",
        Location = example.Location,
        ResourceGroupName = example.Name,
        ServicePlanId = exampleServicePlan.Id,
        StorageAccountName = exampleAccount.Name,
        StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
        SiteConfig = new Azure.AppService.Inputs.LinuxFunctionAppSiteConfigArgs
        {
            ApplicationStack = new Azure.AppService.Inputs.LinuxFunctionAppSiteConfigApplicationStackArgs
            {
                PythonVersion = "3.9",
            },
        },
    });
    var exampleFunctionAppFunction = new Azure.AppService.FunctionAppFunction("example", new()
    {
        Name = "example-function-app-function",
        FunctionAppId = exampleLinuxFunctionApp.Id,
        Language = "Python",
        TestData = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["name"] = "Azure",
        }),
        ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["bindings"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["authLevel"] = "function",
                    ["direction"] = "in",
                    ["methods"] = new[]
                    {
                        "get",
                        "post",
                    },
                    ["name"] = "req",
                    ["type"] = "httpTrigger",
                },
                new Dictionary<string, object?>
                {
                    ["direction"] = "out",
                    ["name"] = "$return",
                    ["type"] = "http",
                },
            },
        }),
    });
});
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.appservice.ServicePlan;
import com.pulumi.azure.appservice.ServicePlanArgs;
import com.pulumi.azure.appservice.LinuxFunctionApp;
import com.pulumi.azure.appservice.LinuxFunctionAppArgs;
import com.pulumi.azure.appservice.inputs.LinuxFunctionAppSiteConfigArgs;
import com.pulumi.azure.appservice.inputs.LinuxFunctionAppSiteConfigApplicationStackArgs;
import com.pulumi.azure.appservice.FunctionAppFunction;
import com.pulumi.azure.appservice.FunctionAppFunctionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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-group")
            .location("West Europe")
            .build());
        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("examplesa")
            .resourceGroupName(example.name())
            .location(example.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());
        var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
            .name("example-service-plan")
            .location(example.location())
            .resourceGroupName(example.name())
            .osType("Linux")
            .skuName("S1")
            .build());
        var exampleLinuxFunctionApp = new LinuxFunctionApp("exampleLinuxFunctionApp", LinuxFunctionAppArgs.builder()
            .name("example-function-app")
            .location(example.location())
            .resourceGroupName(example.name())
            .servicePlanId(exampleServicePlan.id())
            .storageAccountName(exampleAccount.name())
            .storageAccountAccessKey(exampleAccount.primaryAccessKey())
            .siteConfig(LinuxFunctionAppSiteConfigArgs.builder()
                .applicationStack(LinuxFunctionAppSiteConfigApplicationStackArgs.builder()
                    .pythonVersion("3.9")
                    .build())
                .build())
            .build());
        var exampleFunctionAppFunction = new FunctionAppFunction("exampleFunctionAppFunction", FunctionAppFunctionArgs.builder()
            .name("example-function-app-function")
            .functionAppId(exampleLinuxFunctionApp.id())
            .language("Python")
            .testData(serializeJson(
                jsonObject(
                    jsonProperty("name", "Azure")
                )))
            .configJson(serializeJson(
                jsonObject(
                    jsonProperty("bindings", jsonArray(
                        jsonObject(
                            jsonProperty("authLevel", "function"),
                            jsonProperty("direction", "in"),
                            jsonProperty("methods", jsonArray(
                                "get", 
                                "post"
                            )),
                            jsonProperty("name", "req"),
                            jsonProperty("type", "httpTrigger")
                        ), 
                        jsonObject(
                            jsonProperty("direction", "out"),
                            jsonProperty("name", "$return"),
                            jsonProperty("type", "http")
                        )
                    ))
                )))
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-group
      location: West Europe
  exampleAccount:
    type: azure:storage:Account
    name: example
    properties:
      name: examplesa
      resourceGroupName: ${example.name}
      location: ${example.location}
      accountTier: Standard
      accountReplicationType: LRS
  exampleServicePlan:
    type: azure:appservice:ServicePlan
    name: example
    properties:
      name: example-service-plan
      location: ${example.location}
      resourceGroupName: ${example.name}
      osType: Linux
      skuName: S1
  exampleLinuxFunctionApp:
    type: azure:appservice:LinuxFunctionApp
    name: example
    properties:
      name: example-function-app
      location: ${example.location}
      resourceGroupName: ${example.name}
      servicePlanId: ${exampleServicePlan.id}
      storageAccountName: ${exampleAccount.name}
      storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
      siteConfig:
        applicationStack:
          pythonVersion: '3.9'
  exampleFunctionAppFunction:
    type: azure:appservice:FunctionAppFunction
    name: example
    properties:
      name: example-function-app-function
      functionAppId: ${exampleLinuxFunctionApp.id}
      language: Python
      testData:
        fn::toJSON:
          name: Azure
      configJson:
        fn::toJSON:
          bindings:
            - authLevel: function
              direction: in
              methods:
                - get
                - post
              name: req
              type: httpTrigger
            - direction: out
              name: $return
              type: http
HTTP Trigger With Code Upload
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";
const example = new azure.core.ResourceGroup("example", {
    name: "example-group",
    location: "West Europe",
});
const exampleAccount = new azure.storage.Account("example", {
    name: "examplesa",
    resourceGroupName: example.name,
    location: example.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const exampleServicePlan = new azure.appservice.ServicePlan("example", {
    name: "example-service-plan",
    location: example.location,
    resourceGroupName: example.name,
    osType: "Windows",
    skuName: "S1",
});
const exampleWindowsFunctionApp = new azure.appservice.WindowsFunctionApp("example", {
    name: "example-function-app",
    location: example.location,
    resourceGroupName: example.name,
    servicePlanId: exampleServicePlan.id,
    storageAccountName: exampleAccount.name,
    storageAccountAccessKey: exampleAccount.primaryAccessKey,
    siteConfig: {
        applicationStack: {
            dotnetVersion: "6",
        },
    },
});
const exampleFunctionAppFunction = new azure.appservice.FunctionAppFunction("example", {
    name: "example-function-app-function",
    functionAppId: exampleWindowsFunctionApp.id,
    language: "CSharp",
    files: [{
        name: "run.csx",
        content: std.file({
            input: "exampledata/run.csx",
        }).then(invoke => invoke.result),
    }],
    testData: JSON.stringify({
        name: "Azure",
    }),
    configJson: JSON.stringify({
        bindings: [
            {
                authLevel: "function",
                direction: "in",
                methods: [
                    "get",
                    "post",
                ],
                name: "req",
                type: "httpTrigger",
            },
            {
                direction: "out",
                name: "$return",
                type: "http",
            },
        ],
    }),
});
import pulumi
import json
import pulumi_azure as azure
import pulumi_std as std
example = azure.core.ResourceGroup("example",
    name="example-group",
    location="West Europe")
example_account = azure.storage.Account("example",
    name="examplesa",
    resource_group_name=example.name,
    location=example.location,
    account_tier="Standard",
    account_replication_type="LRS")
example_service_plan = azure.appservice.ServicePlan("example",
    name="example-service-plan",
    location=example.location,
    resource_group_name=example.name,
    os_type="Windows",
    sku_name="S1")
example_windows_function_app = azure.appservice.WindowsFunctionApp("example",
    name="example-function-app",
    location=example.location,
    resource_group_name=example.name,
    service_plan_id=example_service_plan.id,
    storage_account_name=example_account.name,
    storage_account_access_key=example_account.primary_access_key,
    site_config={
        "application_stack": {
            "dotnet_version": "6",
        },
    })
example_function_app_function = azure.appservice.FunctionAppFunction("example",
    name="example-function-app-function",
    function_app_id=example_windows_function_app.id,
    language="CSharp",
    files=[{
        "name": "run.csx",
        "content": std.file(input="exampledata/run.csx").result,
    }],
    test_data=json.dumps({
        "name": "Azure",
    }),
    config_json=json.dumps({
        "bindings": [
            {
                "authLevel": "function",
                "direction": "in",
                "methods": [
                    "get",
                    "post",
                ],
                "name": "req",
                "type": "httpTrigger",
            },
            {
                "direction": "out",
                "name": "$return",
                "type": "http",
            },
        ],
    }))
package main
import (
	"encoding/json"
	"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-std/sdk/go/std"
	"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-group"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
			Name:                   pulumi.String("examplesa"),
			ResourceGroupName:      example.Name,
			Location:               example.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
			Name:              pulumi.String("example-service-plan"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			OsType:            pulumi.String("Windows"),
			SkuName:           pulumi.String("S1"),
		})
		if err != nil {
			return err
		}
		exampleWindowsFunctionApp, err := appservice.NewWindowsFunctionApp(ctx, "example", &appservice.WindowsFunctionAppArgs{
			Name:                    pulumi.String("example-function-app"),
			Location:                example.Location,
			ResourceGroupName:       example.Name,
			ServicePlanId:           exampleServicePlan.ID(),
			StorageAccountName:      exampleAccount.Name,
			StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
			SiteConfig: &appservice.WindowsFunctionAppSiteConfigArgs{
				ApplicationStack: &appservice.WindowsFunctionAppSiteConfigApplicationStackArgs{
					DotnetVersion: pulumi.String("6"),
				},
			},
		})
		if err != nil {
			return err
		}
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "exampledata/run.csx",
		}, nil)
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"name": "Azure",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		tmpJSON1, err := json.Marshal(map[string]interface{}{
			"bindings": []interface{}{
				map[string]interface{}{
					"authLevel": "function",
					"direction": "in",
					"methods": []string{
						"get",
						"post",
					},
					"name": "req",
					"type": "httpTrigger",
				},
				map[string]interface{}{
					"direction": "out",
					"name":      "$return",
					"type":      "http",
				},
			},
		})
		if err != nil {
			return err
		}
		json1 := string(tmpJSON1)
		_, err = appservice.NewFunctionAppFunction(ctx, "example", &appservice.FunctionAppFunctionArgs{
			Name:          pulumi.String("example-function-app-function"),
			FunctionAppId: exampleWindowsFunctionApp.ID(),
			Language:      pulumi.String("CSharp"),
			Files: appservice.FunctionAppFunctionFileArray{
				&appservice.FunctionAppFunctionFileArgs{
					Name:    pulumi.String("run.csx"),
					Content: pulumi.String(invokeFile.Result),
				},
			},
			TestData:   pulumi.String(json0),
			ConfigJson: pulumi.String(json1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-group",
        Location = "West Europe",
    });
    var exampleAccount = new Azure.Storage.Account("example", new()
    {
        Name = "examplesa",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
    });
    var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
    {
        Name = "example-service-plan",
        Location = example.Location,
        ResourceGroupName = example.Name,
        OsType = "Windows",
        SkuName = "S1",
    });
    var exampleWindowsFunctionApp = new Azure.AppService.WindowsFunctionApp("example", new()
    {
        Name = "example-function-app",
        Location = example.Location,
        ResourceGroupName = example.Name,
        ServicePlanId = exampleServicePlan.Id,
        StorageAccountName = exampleAccount.Name,
        StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
        SiteConfig = new Azure.AppService.Inputs.WindowsFunctionAppSiteConfigArgs
        {
            ApplicationStack = new Azure.AppService.Inputs.WindowsFunctionAppSiteConfigApplicationStackArgs
            {
                DotnetVersion = "6",
            },
        },
    });
    var exampleFunctionAppFunction = new Azure.AppService.FunctionAppFunction("example", new()
    {
        Name = "example-function-app-function",
        FunctionAppId = exampleWindowsFunctionApp.Id,
        Language = "CSharp",
        Files = new[]
        {
            new Azure.AppService.Inputs.FunctionAppFunctionFileArgs
            {
                Name = "run.csx",
                Content = Std.File.Invoke(new()
                {
                    Input = "exampledata/run.csx",
                }).Apply(invoke => invoke.Result),
            },
        },
        TestData = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["name"] = "Azure",
        }),
        ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["bindings"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["authLevel"] = "function",
                    ["direction"] = "in",
                    ["methods"] = new[]
                    {
                        "get",
                        "post",
                    },
                    ["name"] = "req",
                    ["type"] = "httpTrigger",
                },
                new Dictionary<string, object?>
                {
                    ["direction"] = "out",
                    ["name"] = "$return",
                    ["type"] = "http",
                },
            },
        }),
    });
});
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.appservice.ServicePlan;
import com.pulumi.azure.appservice.ServicePlanArgs;
import com.pulumi.azure.appservice.WindowsFunctionApp;
import com.pulumi.azure.appservice.WindowsFunctionAppArgs;
import com.pulumi.azure.appservice.inputs.WindowsFunctionAppSiteConfigArgs;
import com.pulumi.azure.appservice.inputs.WindowsFunctionAppSiteConfigApplicationStackArgs;
import com.pulumi.azure.appservice.FunctionAppFunction;
import com.pulumi.azure.appservice.FunctionAppFunctionArgs;
import com.pulumi.azure.appservice.inputs.FunctionAppFunctionFileArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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-group")
            .location("West Europe")
            .build());
        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("examplesa")
            .resourceGroupName(example.name())
            .location(example.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());
        var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
            .name("example-service-plan")
            .location(example.location())
            .resourceGroupName(example.name())
            .osType("Windows")
            .skuName("S1")
            .build());
        var exampleWindowsFunctionApp = new WindowsFunctionApp("exampleWindowsFunctionApp", WindowsFunctionAppArgs.builder()
            .name("example-function-app")
            .location(example.location())
            .resourceGroupName(example.name())
            .servicePlanId(exampleServicePlan.id())
            .storageAccountName(exampleAccount.name())
            .storageAccountAccessKey(exampleAccount.primaryAccessKey())
            .siteConfig(WindowsFunctionAppSiteConfigArgs.builder()
                .applicationStack(WindowsFunctionAppSiteConfigApplicationStackArgs.builder()
                    .dotnetVersion("6")
                    .build())
                .build())
            .build());
        var exampleFunctionAppFunction = new FunctionAppFunction("exampleFunctionAppFunction", FunctionAppFunctionArgs.builder()
            .name("example-function-app-function")
            .functionAppId(exampleWindowsFunctionApp.id())
            .language("CSharp")
            .files(FunctionAppFunctionFileArgs.builder()
                .name("run.csx")
                .content(StdFunctions.file(FileArgs.builder()
                    .input("exampledata/run.csx")
                    .build()).result())
                .build())
            .testData(serializeJson(
                jsonObject(
                    jsonProperty("name", "Azure")
                )))
            .configJson(serializeJson(
                jsonObject(
                    jsonProperty("bindings", jsonArray(
                        jsonObject(
                            jsonProperty("authLevel", "function"),
                            jsonProperty("direction", "in"),
                            jsonProperty("methods", jsonArray(
                                "get", 
                                "post"
                            )),
                            jsonProperty("name", "req"),
                            jsonProperty("type", "httpTrigger")
                        ), 
                        jsonObject(
                            jsonProperty("direction", "out"),
                            jsonProperty("name", "$return"),
                            jsonProperty("type", "http")
                        )
                    ))
                )))
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-group
      location: West Europe
  exampleAccount:
    type: azure:storage:Account
    name: example
    properties:
      name: examplesa
      resourceGroupName: ${example.name}
      location: ${example.location}
      accountTier: Standard
      accountReplicationType: LRS
  exampleServicePlan:
    type: azure:appservice:ServicePlan
    name: example
    properties:
      name: example-service-plan
      location: ${example.location}
      resourceGroupName: ${example.name}
      osType: Windows
      skuName: S1
  exampleWindowsFunctionApp:
    type: azure:appservice:WindowsFunctionApp
    name: example
    properties:
      name: example-function-app
      location: ${example.location}
      resourceGroupName: ${example.name}
      servicePlanId: ${exampleServicePlan.id}
      storageAccountName: ${exampleAccount.name}
      storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
      siteConfig:
        applicationStack:
          dotnetVersion: '6'
  exampleFunctionAppFunction:
    type: azure:appservice:FunctionAppFunction
    name: example
    properties:
      name: example-function-app-function
      functionAppId: ${exampleWindowsFunctionApp.id}
      language: CSharp
      files:
        - name: run.csx
          content:
            fn::invoke:
              function: std:file
              arguments:
                input: exampledata/run.csx
              return: result
      testData:
        fn::toJSON:
          name: Azure
      configJson:
        fn::toJSON:
          bindings:
            - authLevel: function
              direction: in
              methods:
                - get
                - post
              name: req
              type: httpTrigger
            - direction: out
              name: $return
              type: http
Create FunctionAppFunction Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FunctionAppFunction(name: string, args: FunctionAppFunctionArgs, opts?: CustomResourceOptions);@overload
def FunctionAppFunction(resource_name: str,
                        args: FunctionAppFunctionArgs,
                        opts: Optional[ResourceOptions] = None)
@overload
def FunctionAppFunction(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        config_json: Optional[str] = None,
                        function_app_id: Optional[str] = None,
                        enabled: Optional[bool] = None,
                        files: Optional[Sequence[FunctionAppFunctionFileArgs]] = None,
                        language: Optional[str] = None,
                        name: Optional[str] = None,
                        test_data: Optional[str] = None)func NewFunctionAppFunction(ctx *Context, name string, args FunctionAppFunctionArgs, opts ...ResourceOption) (*FunctionAppFunction, error)public FunctionAppFunction(string name, FunctionAppFunctionArgs args, CustomResourceOptions? opts = null)
public FunctionAppFunction(String name, FunctionAppFunctionArgs args)
public FunctionAppFunction(String name, FunctionAppFunctionArgs args, CustomResourceOptions options)
type: azure:appservice:FunctionAppFunction
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args FunctionAppFunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FunctionAppFunctionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FunctionAppFunctionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionAppFunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionAppFunctionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var functionAppFunctionResource = new Azure.AppService.FunctionAppFunction("functionAppFunctionResource", new()
{
    ConfigJson = "string",
    FunctionAppId = "string",
    Enabled = false,
    Files = new[]
    {
        new Azure.AppService.Inputs.FunctionAppFunctionFileArgs
        {
            Content = "string",
            Name = "string",
        },
    },
    Language = "string",
    Name = "string",
    TestData = "string",
});
example, err := appservice.NewFunctionAppFunction(ctx, "functionAppFunctionResource", &appservice.FunctionAppFunctionArgs{
	ConfigJson:    pulumi.String("string"),
	FunctionAppId: pulumi.String("string"),
	Enabled:       pulumi.Bool(false),
	Files: appservice.FunctionAppFunctionFileArray{
		&appservice.FunctionAppFunctionFileArgs{
			Content: pulumi.String("string"),
			Name:    pulumi.String("string"),
		},
	},
	Language: pulumi.String("string"),
	Name:     pulumi.String("string"),
	TestData: pulumi.String("string"),
})
var functionAppFunctionResource = new FunctionAppFunction("functionAppFunctionResource", FunctionAppFunctionArgs.builder()
    .configJson("string")
    .functionAppId("string")
    .enabled(false)
    .files(FunctionAppFunctionFileArgs.builder()
        .content("string")
        .name("string")
        .build())
    .language("string")
    .name("string")
    .testData("string")
    .build());
function_app_function_resource = azure.appservice.FunctionAppFunction("functionAppFunctionResource",
    config_json="string",
    function_app_id="string",
    enabled=False,
    files=[{
        "content": "string",
        "name": "string",
    }],
    language="string",
    name="string",
    test_data="string")
const functionAppFunctionResource = new azure.appservice.FunctionAppFunction("functionAppFunctionResource", {
    configJson: "string",
    functionAppId: "string",
    enabled: false,
    files: [{
        content: "string",
        name: "string",
    }],
    language: "string",
    name: "string",
    testData: "string",
});
type: azure:appservice:FunctionAppFunction
properties:
    configJson: string
    enabled: false
    files:
        - content: string
          name: string
    functionAppId: string
    language: string
    name: string
    testData: string
FunctionAppFunction Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The FunctionAppFunction resource accepts the following input properties:
- ConfigJson string
- The config for this Function in JSON format.
- FunctionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- Enabled bool
- Should this function be enabled. Defaults to true.
- Files
List<FunctionApp Function File> 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- Language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- Name string
- The name of the function. Changing this forces a new resource to be created.
- TestData string
- The test data for the function.
- ConfigJson string
- The config for this Function in JSON format.
- FunctionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- Enabled bool
- Should this function be enabled. Defaults to true.
- Files
[]FunctionApp Function File Args 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- Language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- Name string
- The name of the function. Changing this forces a new resource to be created.
- TestData string
- The test data for the function.
- configJson String
- The config for this Function in JSON format.
- functionApp StringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- enabled Boolean
- Should this function be enabled. Defaults to true.
- files
List<FunctionApp Function File> 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- language String
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name String
- The name of the function. Changing this forces a new resource to be created.
- testData String
- The test data for the function.
- configJson string
- The config for this Function in JSON format.
- functionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- enabled boolean
- Should this function be enabled. Defaults to true.
- files
FunctionApp Function File[] 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name string
- The name of the function. Changing this forces a new resource to be created.
- testData string
- The test data for the function.
- config_json str
- The config for this Function in JSON format.
- function_app_ strid 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- enabled bool
- Should this function be enabled. Defaults to true.
- files
Sequence[FunctionApp Function File Args] 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- language str
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name str
- The name of the function. Changing this forces a new resource to be created.
- test_data str
- The test data for the function.
- configJson String
- The config for this Function in JSON format.
- functionApp StringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- enabled Boolean
- Should this function be enabled. Defaults to true.
- files List<Property Map>
- A fileblock as detailed below. Changing this forces a new resource to be created.
- language String
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name String
- The name of the function. Changing this forces a new resource to be created.
- testData String
- The test data for the function.
Outputs
All input properties are implicitly available as output properties. Additionally, the FunctionAppFunction resource produces the following output properties:
- ConfigUrl string
- The URL of the configuration JSON.
- Id string
- The provider-assigned unique ID for this managed resource.
- InvocationUrl string
- The invocation URL.
- ScriptRoot stringPath Url 
- The Script root path URL.
- ScriptUrl string
- The script URL.
- SecretsFile stringUrl 
- The URL for the Secrets File.
- TestData stringUrl 
- The Test data URL.
- Url string
- The function URL.
- ConfigUrl string
- The URL of the configuration JSON.
- Id string
- The provider-assigned unique ID for this managed resource.
- InvocationUrl string
- The invocation URL.
- ScriptRoot stringPath Url 
- The Script root path URL.
- ScriptUrl string
- The script URL.
- SecretsFile stringUrl 
- The URL for the Secrets File.
- TestData stringUrl 
- The Test data URL.
- Url string
- The function URL.
- configUrl String
- The URL of the configuration JSON.
- id String
- The provider-assigned unique ID for this managed resource.
- invocationUrl String
- The invocation URL.
- scriptRoot StringPath Url 
- The Script root path URL.
- scriptUrl String
- The script URL.
- secretsFile StringUrl 
- The URL for the Secrets File.
- testData StringUrl 
- The Test data URL.
- url String
- The function URL.
- configUrl string
- The URL of the configuration JSON.
- id string
- The provider-assigned unique ID for this managed resource.
- invocationUrl string
- The invocation URL.
- scriptRoot stringPath Url 
- The Script root path URL.
- scriptUrl string
- The script URL.
- secretsFile stringUrl 
- The URL for the Secrets File.
- testData stringUrl 
- The Test data URL.
- url string
- The function URL.
- config_url str
- The URL of the configuration JSON.
- id str
- The provider-assigned unique ID for this managed resource.
- invocation_url str
- The invocation URL.
- script_root_ strpath_ url 
- The Script root path URL.
- script_url str
- The script URL.
- secrets_file_ strurl 
- The URL for the Secrets File.
- test_data_ strurl 
- The Test data URL.
- url str
- The function URL.
- configUrl String
- The URL of the configuration JSON.
- id String
- The provider-assigned unique ID for this managed resource.
- invocationUrl String
- The invocation URL.
- scriptRoot StringPath Url 
- The Script root path URL.
- scriptUrl String
- The script URL.
- secretsFile StringUrl 
- The URL for the Secrets File.
- testData StringUrl 
- The Test data URL.
- url String
- The function URL.
Look up Existing FunctionAppFunction Resource
Get an existing FunctionAppFunction resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: FunctionAppFunctionState, opts?: CustomResourceOptions): FunctionAppFunction@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config_json: Optional[str] = None,
        config_url: Optional[str] = None,
        enabled: Optional[bool] = None,
        files: Optional[Sequence[FunctionAppFunctionFileArgs]] = None,
        function_app_id: Optional[str] = None,
        invocation_url: Optional[str] = None,
        language: Optional[str] = None,
        name: Optional[str] = None,
        script_root_path_url: Optional[str] = None,
        script_url: Optional[str] = None,
        secrets_file_url: Optional[str] = None,
        test_data: Optional[str] = None,
        test_data_url: Optional[str] = None,
        url: Optional[str] = None) -> FunctionAppFunctionfunc GetFunctionAppFunction(ctx *Context, name string, id IDInput, state *FunctionAppFunctionState, opts ...ResourceOption) (*FunctionAppFunction, error)public static FunctionAppFunction Get(string name, Input<string> id, FunctionAppFunctionState? state, CustomResourceOptions? opts = null)public static FunctionAppFunction get(String name, Output<String> id, FunctionAppFunctionState state, CustomResourceOptions options)resources:  _:    type: azure:appservice:FunctionAppFunction    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- ConfigJson string
- The config for this Function in JSON format.
- ConfigUrl string
- The URL of the configuration JSON.
- Enabled bool
- Should this function be enabled. Defaults to true.
- Files
List<FunctionApp Function File> 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- FunctionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- InvocationUrl string
- The invocation URL.
- Language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- Name string
- The name of the function. Changing this forces a new resource to be created.
- ScriptRoot stringPath Url 
- The Script root path URL.
- ScriptUrl string
- The script URL.
- SecretsFile stringUrl 
- The URL for the Secrets File.
- TestData string
- The test data for the function.
- TestData stringUrl 
- The Test data URL.
- Url string
- The function URL.
- ConfigJson string
- The config for this Function in JSON format.
- ConfigUrl string
- The URL of the configuration JSON.
- Enabled bool
- Should this function be enabled. Defaults to true.
- Files
[]FunctionApp Function File Args 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- FunctionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- InvocationUrl string
- The invocation URL.
- Language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- Name string
- The name of the function. Changing this forces a new resource to be created.
- ScriptRoot stringPath Url 
- The Script root path URL.
- ScriptUrl string
- The script URL.
- SecretsFile stringUrl 
- The URL for the Secrets File.
- TestData string
- The test data for the function.
- TestData stringUrl 
- The Test data URL.
- Url string
- The function URL.
- configJson String
- The config for this Function in JSON format.
- configUrl String
- The URL of the configuration JSON.
- enabled Boolean
- Should this function be enabled. Defaults to true.
- files
List<FunctionApp Function File> 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- functionApp StringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- invocationUrl String
- The invocation URL.
- language String
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name String
- The name of the function. Changing this forces a new resource to be created.
- scriptRoot StringPath Url 
- The Script root path URL.
- scriptUrl String
- The script URL.
- secretsFile StringUrl 
- The URL for the Secrets File.
- testData String
- The test data for the function.
- testData StringUrl 
- The Test data URL.
- url String
- The function URL.
- configJson string
- The config for this Function in JSON format.
- configUrl string
- The URL of the configuration JSON.
- enabled boolean
- Should this function be enabled. Defaults to true.
- files
FunctionApp Function File[] 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- functionApp stringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- invocationUrl string
- The invocation URL.
- language string
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name string
- The name of the function. Changing this forces a new resource to be created.
- scriptRoot stringPath Url 
- The Script root path URL.
- scriptUrl string
- The script URL.
- secretsFile stringUrl 
- The URL for the Secrets File.
- testData string
- The test data for the function.
- testData stringUrl 
- The Test data URL.
- url string
- The function URL.
- config_json str
- The config for this Function in JSON format.
- config_url str
- The URL of the configuration JSON.
- enabled bool
- Should this function be enabled. Defaults to true.
- files
Sequence[FunctionApp Function File Args] 
- A fileblock as detailed below. Changing this forces a new resource to be created.
- function_app_ strid 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- invocation_url str
- The invocation URL.
- language str
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name str
- The name of the function. Changing this forces a new resource to be created.
- script_root_ strpath_ url 
- The Script root path URL.
- script_url str
- The script URL.
- secrets_file_ strurl 
- The URL for the Secrets File.
- test_data str
- The test data for the function.
- test_data_ strurl 
- The Test data URL.
- url str
- The function URL.
- configJson String
- The config for this Function in JSON format.
- configUrl String
- The URL of the configuration JSON.
- enabled Boolean
- Should this function be enabled. Defaults to true.
- files List<Property Map>
- A fileblock as detailed below. Changing this forces a new resource to be created.
- functionApp StringId 
- The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
- invocationUrl String
- The invocation URL.
- language String
- The language the Function is written in. Possible values are - CSharp,- Custom,- Java,- Javascript,- Python,- PowerShell, and- TypeScript.- NOTE: when using - Customlanguage, you must specify the code handler in the- host.jsonfile for your function. See the official docs for more information.
- name String
- The name of the function. Changing this forces a new resource to be created.
- scriptRoot StringPath Url 
- The Script root path URL.
- scriptUrl String
- The script URL.
- secretsFile StringUrl 
- The URL for the Secrets File.
- testData String
- The test data for the function.
- testData StringUrl 
- The Test data URL.
- url String
- The function URL.
Supporting Types
FunctionAppFunctionFile, FunctionAppFunctionFileArgs        
Import
a Function App Function can be imported using the resource id, e.g.
$ pulumi import azure:appservice/functionAppFunction:FunctionAppFunction example "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/functions/function1"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.