New-AzFunctionApp

Creates a function app.

Syntax

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

Type:String
Aliases:AppInsightsKey
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ApplicationInsightsName

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

Type:String
Aliases:AppInsightsName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AppSetting

Function app settings.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AsJob

Runs the cmdlet as a background job.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableApplicationInsights

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

Type:SwitchParameter
Aliases:DisableAppInsights
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Environment

Name of the container app environment.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-FunctionsVersion

The Functions version.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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}'

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IdentityType

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

Type:ManagedServiceIdentityType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Image

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

Type:String
Aliases:DockerImageName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Location

The location for the consumption plan.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The name of the function app.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OSType

The OS to host the function app.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Returns true when the command succeeds.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PlanName

The name of the service plan.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RegistryCredential

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

Type:PSCredential
Aliases:DockerRegistryCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RegistryServer

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceCpu

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

Type:Double
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceMemory

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Runtime

The function runtime.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RuntimeVersion

The function runtime.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ScaleMaxReplica

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ScaleMinReplica

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-StorageAccountName

The name of the storage account.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The Azure subscription ID.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Resource tags.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WorkloadProfileName

The workload profile name to run the container app on.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

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