Edit

Share via


New-AzFunctionApp

Creates a function app.

Syntax

Consumption (Default)

New-AzFunctionApp
    -ResourceGroupName <String>
    -Name <String>
    -StorageAccountName <String>
    -Location <String>
    -Runtime <String>
    [-SubscriptionId <String>]
    [-ApplicationInsightsName <String>]
    [-ApplicationInsightsKey <String>]
    [-OSType <String>]
    [-RuntimeVersion <String>]
    [-FunctionsVersion <String>]
    [-DisableApplicationInsights]
    [-PassThru]
    [-Tag <Hashtable>]
    [-AppSetting <Hashtable>]
    [-IdentityType <ManagedServiceIdentityType>]
    [-IdentityID <String[]>]
    [-DefaultProfile <PSObject>]
    [-NoWait]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByAppServicePlan

New-AzFunctionApp
    -ResourceGroupName <String>
    -Name <String>
    -StorageAccountName <String>
    -Runtime <String>
    -PlanName <String>
    [-SubscriptionId <String>]
    [-ApplicationInsightsName <String>]
    [-ApplicationInsightsKey <String>]
    [-OSType <String>]
    [-RuntimeVersion <String>]
    [-FunctionsVersion <String>]
    [-DisableApplicationInsights]
    [-PassThru]
    [-Tag <Hashtable>]
    [-AppSetting <Hashtable>]
    [-IdentityType <ManagedServiceIdentityType>]
    [-IdentityID <String[]>]
    [-DefaultProfile <PSObject>]
    [-NoWait]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

EnvironmentForContainerApp

New-AzFunctionApp
    -ResourceGroupName <String>
    -Name <String>
    -StorageAccountName <String>
    -Environment <String>
    [-SubscriptionId <String>]
    [-ApplicationInsightsName <String>]
    [-ApplicationInsightsKey <String>]
    [-DisableApplicationInsights]
    [-PassThru]
    [-Tag <Hashtable>]
    [-AppSetting <Hashtable>]
    [-IdentityType <ManagedServiceIdentityType>]
    [-IdentityID <String[]>]
    [-Image <String>]
    [-RegistryCredential <PSCredential>]
    [-WorkloadProfileName <String>]
    [-ResourceCpu <Double>]
    [-ResourceMemory <String>]
    [-ScaleMaxReplica <Int32>]
    [-ScaleMinReplica <Int32>]
    [-RegistryServer <String>]
    [-DefaultProfile <PSObject>]
    [-NoWait]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CustomDockerImage

New-AzFunctionApp
    -ResourceGroupName <String>
    -Name <String>
    -StorageAccountName <String>
    -Image <String>
    -PlanName <String>
    [-SubscriptionId <String>]
    [-ApplicationInsightsName <String>]
    [-ApplicationInsightsKey <String>]
    [-DisableApplicationInsights]
    [-PassThru]
    [-Tag <Hashtable>]
    [-AppSetting <Hashtable>]
    [-IdentityType <ManagedServiceIdentityType>]
    [-IdentityID <String[]>]
    [-RegistryCredential <PSCredential>]
    [-DefaultProfile <PSObject>]
    [-NoWait]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Creates a function app.

Examples

Example 1: Create a consumption PowerShell function app in Central US.

New-AzFunctionApp -Name MyUniqueFunctionAppName `
                  -ResourceGroupName MyResourceGroupName `
                  -Location centralUS `
                  -StorageAccountName MyStorageAccountName `
                  -Runtime PowerShell

This command creates a consumption PowerShell function app in Central US.

Example 2: Create a PowerShell function app which will be hosted in a service plan.

New-AzFunctionApp -Name MyUniqueFunctionAppName `
                  -ResourceGroupName MyResourceGroupName `
                  -PlanName MyPlanName `
                  -StorageAccountName MyStorageAccountName `
                  -Runtime PowerShell

This command creates a PowerShell function app which will be hosted in a service plan.

Example 3: Create a function app using a using a private ACR image.

New-AzFunctionApp -Name MyUniqueFunctionAppName `
                  -ResourceGroupName MyResourceGroupName `
                  -PlanName MyPlanName `
                  -StorageAccountName MyStorageAccountName `
                  -DockerImageName myacr.azurecr.io/myimage:tag

This command creates a function app using a using a private ACR image.

Example 4: Create a function app on container app.

New-AzFunctionApp -Name MyUniqueFunctionAppName `
                  -ResourceGroupName MyResourceGroupName `
                  -StorageAccountName MyStorageAccountName `
                  -Environment MyEnvironment `
                  -WorkloadProfileName MyWorkloadProfileName

This command create a function app on container app using the default .Net image.

Parameters

-ApplicationInsightsKey

Instrumentation key of App Insights to be added.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AppInsightsKey

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ApplicationInsightsName

Name of the existing App Insights project to be added to the function app.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AppInsightsName

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AppSetting

Function app settings.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Runs the cmdlet as a background job.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

Creates a function app.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableApplicationInsights

Disable creating application insights resource during the function app creation. No logs will be available.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DisableAppInsights

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Environment

Name of the container app environment.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FunctionsVersion

The Functions version.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Consumption
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByAppServicePlan
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IdentityID

Specifies the list of user identities associated with the function app. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IdentityType

Specifies the type of identity used for the function app. The acceptable values for this parameter are: - SystemAssigned - UserAssigned

Parameter properties

Type:ManagedServiceIdentityType
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Image

Container image name, e.g., publisher/image-name:tag.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DockerImageName

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

The ___location for the consumption plan.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Consumption
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the function app.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoWait

Starts the operation and returns immediately, before the operation is completed. In order to determine if the operation has successfully been completed, use some other mechanism.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OSType

The OS to host the function app.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Consumption
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByAppServicePlan
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Returns true when the command succeeds.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PlanName

The name of the service plan.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByAppServicePlan
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CustomDockerImage
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RegistryCredential

The container registry username and password. Required for private registries.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DockerRegistryCredential

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
CustomDockerImage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RegistryServer

The container registry server hostname, e.g. myregistry.azurecr.io.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceCpu

The CPU in cores of the container app. e.g., 0.75.

Parameter properties

Type:Double
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceMemory

The memory size of the container app. e.g., 1.0Gi.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Runtime

The function runtime.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Consumption
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByAppServicePlan
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RuntimeVersion

The function runtime.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Consumption
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByAppServicePlan
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScaleMaxReplica

The maximum number of replicas when creating a function app on container app.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScaleMinReplica

The minimum number of replicas when create function app on container app.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccountName

The name of the storage account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

The Azure subscription ID.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Tag

Resource tags.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WorkloadProfileName

The workload profile name to run the container app on.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EnvironmentForContainerApp
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

ISite