FunctionAppFunction

class FunctionAppFunction : KotlinCustomResource

Manages a Function App Function.

Example Usage

Basic HTTP Trigger

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());
}
}

HTTP Trigger With Code Upload

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());
}
}

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"

Properties

Link copied to clipboard
val configJson: Output<String>

The config for this Function in JSON format.

Link copied to clipboard
val configUrl: Output<String>

The URL of the configuration JSON.

Link copied to clipboard
val enabled: Output<Boolean>?

Should this function be enabled. Defaults to true.

Link copied to clipboard

A file block as detailed below. Changing this forces a new resource to be created.

Link copied to clipboard
val functionAppId: Output<String>

The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val invocationUrl: Output<String>

The invocation URL.

Link copied to clipboard
val language: Output<String>?

The language the Function is written in. Possible values are CSharp, Custom, Java, Javascript, Python, PowerShell, and TypeScript.

Link copied to clipboard
val name: Output<String>

The name of the function. Changing this forces a new resource to be created.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The Script root path URL.

Link copied to clipboard
val scriptUrl: Output<String>

The script URL.

Link copied to clipboard
val secretsFileUrl: Output<String>

The URL for the Secrets File.

Link copied to clipboard
val testData: Output<String>?

The test data for the function.

Link copied to clipboard
val testDataUrl: Output<String>

The Test data URL.

Link copied to clipboard
val url: Output<String>

The function URL.

Link copied to clipboard
val urn: Output<String>