Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

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>]
 [-EnableSystemAssignedIdentity]
 [-UserAssignedIdentity <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>]
 [-EnableSystemAssignedIdentity]
 [-UserAssignedIdentity <String[]>]
 [-DefaultProfile <PSObject>]
 [-NoWait]
 [-AsJob]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

FlexConsumption

New-AzFunctionApp
 -ResourceGroupName <String>
 -Name <String>
 -StorageAccountName <String>
 -Runtime <String>
 -FlexConsumptionLocation <String>
 [-SubscriptionId <String>]
 [-ApplicationInsightsName <String>]
 [-ApplicationInsightsKey <String>]
 [-RuntimeVersion <String>]
 [-DisableApplicationInsights]
 [-PassThru]
 [-Tag <Hashtable>]
 [-AppSetting <Hashtable>]
 [-EnableSystemAssignedIdentity]
 [-UserAssignedIdentity <String[]>]
 [-DeploymentStorageName <String>]
 [-DeploymentStorageContainerName <String>]
 [-DeploymentStorageAuthType <String>]
 [-DeploymentStorageAuthValue <String>]
 [-AlwaysReady <Hashtable[]>]
 [-MaximumInstanceCount <Int32>]
 [-InstanceMemoryMB <Int32>]
 [-HttpPerInstanceConcurrency <Int32>]
 [-EnableZoneRedundancy]
 [-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>]
 [-EnableSystemAssignedIdentity]
 [-UserAssignedIdentity <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>]
 [-EnableSystemAssignedIdentity]
 [-UserAssignedIdentity <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 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 private ACR image.

Example 4: Create a function app on a container app.

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

This command creates a function app on a container app using the default .NET image.

Example 5: Create a PowerShell function app hosted in a Flex Consumption plan.

New-AzFunctionApp -Name MyUniqueFunctionAppName `
 -ResourceGroupName MyResourceGroupName `
 -FlexConsumptionLocation LocationWhereFlexConsumptionIsSupported `
 -StorageAccountName MyStorageAccountName `
 -Runtime PowerShell

This command creates a PowerShell function app hosted in a Flex Consumption plan.

Parameters

-AlwaysReady

Array of hashtables describing the AlwaysReady configuration. Each hashtable must include: - name: The function name or route name. - instanceCount: The number of pre-warmed instances for that function.

 Example:
 @(@{ name = "http"; instanceCount = 2 }).

Parameter properties

Type:

Hashtable[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-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

-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

-AppSetting

Function app settings.

Parameter properties

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

Parameter sets

-AsJob

Runs the cmdlet as a background job.

Parameter properties

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

Parameter sets

-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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

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

Parameter sets

-DeploymentStorageAuthType

Deployment storage authentication type. Allowed values: StorageAccountConnectionString, SystemAssignedIdentity, UserAssignedIdentity

Parameter properties

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

Parameter sets

-DeploymentStorageAuthValue

Deployment storage authentication value used for the chosen auth type (eg: connection string, or user-assigned identity resource id).

Parameter properties

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

Parameter sets

-DeploymentStorageContainerName

Deployment storage container name.

Parameter properties

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

Parameter sets

-DeploymentStorageName

Name of deployment storage account to be used for function app artifacts.

Parameter properties

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

Parameter sets

-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

-EnableSystemAssignedIdentity

Determines whether to enable a system-assigned identity for the resource.

Parameter properties

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

Parameter sets

-EnableZoneRedundancy

Enable zone redundancy for high availability. Applies to Flex Consumption SKU only.

Parameter properties

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

Parameter sets

-Environment

Name of the container app environment.

Parameter properties

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

Parameter sets

-FlexConsumptionLocation

Location to create Flex Consumption function app.

Parameter properties

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

Parameter sets

-FunctionsVersion

The Functions version.

Parameter properties

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

Parameter sets

-HttpPerInstanceConcurrency

The maximum number of concurrent HTTP trigger invocations per instance.

Parameter properties

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

Parameter sets

-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

-InstanceMemoryMB

Per-instance memory in MB for Flex Consumption instances.

Parameter properties

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

Parameter sets

-Location

The location for the consumption plan.

Parameter properties

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

Parameter sets

-MaximumInstanceCount

Maximum instance count for Flex Consumption.

Parameter properties

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

Parameter sets

-Name

The name of the function app.

Parameter properties

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

Parameter sets

-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

-OSType

The OS to host the function app.

Parameter properties

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

Parameter sets

-PassThru

Returns true when the command succeeds.

Parameter properties

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

Parameter sets

-PlanName

The name of the service plan.

Parameter properties

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

Parameter sets

-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

-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

-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

-ResourceGroupName

The name of the resource group.

Parameter properties

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

Parameter sets

-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

-Runtime

The function runtime.

Parameter properties

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

Parameter sets

-RuntimeVersion

The function runtime.

Parameter properties

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

Parameter sets

-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

-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

-StorageAccountName

The name of the storage account.

Parameter properties

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

Parameter sets

-SubscriptionId

The Azure subscription ID.

Parameter properties

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

Parameter sets

-Tag

Resource tags.

Parameter properties

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

Parameter sets

-UserAssignedIdentity

The array of user assigned 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/userAssignedIdentities/{identityName}'

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-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

-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

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

Microsoft.Azure.PowerShell.Cmdlets.Functions.Models.ISite


Feedback

Was this page helpful?