Edit

Share via


Set-AzWebApp

Modifies an Azure Web App.

Syntax

S1

Set-AzWebApp
    [[-AppServicePlan] <String>]
    [[-DefaultDocuments] <String[]>]
    [[-NetFrameworkVersion] <String>]
    [[-PhpVersion] <String>]
    [[-RequestTracingEnabled] <Boolean>]
    [[-HttpLoggingEnabled] <Boolean>]
    [[-DetailedErrorLoggingEnabled] <Boolean>]
    [[-AppSettings] <Hashtable>]
    [[-ConnectionStrings] <Hashtable>]
    [[-HandlerMappings] <System.Collections.Generic.IList`1[Microsoft.Azure.Management.WebSites.Models.HandlerMapping]>]
    [[-ManagedPipelineMode] <String>]
    [[-WebSocketsEnabled] <Boolean>]
    [[-Use32BitWorkerProcess] <Boolean>]
    [[-AutoSwapSlotName] <String>]
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-ContainerImageName <String>]
    [-ContainerRegistryUrl <String>]
    [-ContainerRegistryUser <String>]
    [-ContainerRegistryPassword <SecureString>]
    [-EnableContainerContinuousDeployment <Boolean>]
    [-HostNames <String[]>]
    [-NumberOfWorkers <Int32>]
    [-AsJob]
    [-AssignIdentity <Boolean>]
    [-HttpsOnly <Boolean>]
    [-AzureStoragePath <WebAppAzureStoragePath[]>]
    [-AlwaysOn <Boolean>]
    [-MinTlsVersion <String>]
    [-FtpsState <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

S2

Set-AzWebApp
    [[-Use32BitWorkerProcess] <Boolean>]
    [[-AutoSwapSlotName] <String>]
    [-WebApp] <PSSite>
    [-NumberOfWorkers <Int32>]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Set-AzWebApp cmdlet sets an Azure Web App.

Examples

Example 1

Set-AzWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -AppServicePlan "ContosoPlan"

This command changes the appservice plan associated with the Web App ContosoWebApp associated with the resource group Default-Web-WestUS. Use the link to learn more about changing the appservice plan and constraints associated with it. https://learn.microsoft.com/azure/app-service/app-service-plan-manage#move-an-app-to-another-app-service-plan

Example 2

Set-AzWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -HttpLoggingEnabled $true

This command sets HttpLoggingEnabled to true for Web App ContosoWebApp associated with the resource group Default-Web-WestUS

Example 3

Modifies an Azure Web App. (autogenerated)

Set-AzWebApp -AppSettings <Hashtable> -Name 'ContosoWebApp' -ResourceGroupName 'Default-Web-WestUS'

Example 4

The following example creates a connection string named myConnectionString for Web App ContosoWebApp. This replaces all existing connection strings for Web App ContosoWebApp.

$hashtable =  @{myConnectionString = @{Type='MySql';Value='MySql Connection string'}}
Set-AzWebApp -Name 'ContosoWebApp' -ResourceGroupName 'Default-Web-WestUS' -ConnectionStrings $hashtable

Example 5

Enable application insights for Web App

$key=(Get-AzApplicationInsights -ResourceId $ai).InstrumentationKey
$setting=@{"ApplicationInsightsAgent_EXTENSION_VERSION"="~3"; "APPINSIGHTS_INSTRUMENTATIONKEY"=$key}
Set-AzWebApp -AppSettings $setting -Name 'ContosoWebApp' -ResourceGroupName 'Default-Web-WestUS'

Parameters

-AlwaysOn

Ensure web app gets loaded all the time, rather unloaded after been idle.

Parameter properties

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

Parameter sets

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

-AppServicePlan

App Service Plan Name

Parameter properties

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

Parameter sets

S1
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AppSettings

App Settings HashTable. Existing App Settings will be replaced, removing any settings that are not provided.

Parameter properties

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

Parameter sets

S1
Position:9
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Run cmdlet in the background

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

-AssignIdentity

Enable/disable MSI on an existing azure webapp or functionapp

Parameter properties

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

Parameter sets

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

-AutoSwapSlotName

Destination slot name for auto swap

Parameter properties

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

Parameter sets

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

-AzureStoragePath

Azure Storage to mount inside a Web App for Container. Use New-AzWebAppAzureStoragePath to create it

Parameter properties

Type:

WebAppAzureStoragePath[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ConnectionStrings

Connection Strings HashTable

Parameter properties

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

Parameter sets

S1
Position:10
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ContainerImageName

Container Image Name

Parameter properties

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

Parameter sets

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

-ContainerRegistryPassword

Private Container Registry Password

Parameter properties

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

Parameter sets

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

-ContainerRegistryUrl

Private Container Registry Server Url

Parameter properties

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

Parameter sets

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

-ContainerRegistryUser

Private Container Registry Username

Parameter properties

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

Parameter sets

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

-DefaultDocuments

Default Documents String Array

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

S1
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, 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

-DetailedErrorLoggingEnabled

Detailed Error Logging Enabled Boolean

Parameter properties

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

Parameter sets

S1
Position:8
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableContainerContinuousDeployment

Enables/Disables container continuous deployment webhook

Parameter properties

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

Parameter sets

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

-FtpsState

Set the Ftps state value for an app. Allowed Values [AllAllowed | Disabled | FtpsOnly].

Parameter properties

Type:String
Default value:None
Accepted values:AllAllowed, Disabled, FtpsOnly
Supports wildcards:False
DontShow:False

Parameter sets

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

-HandlerMappings

Handler Mappings IList

Parameter properties

Type:

IList<T>[HandlerMapping]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

S1
Position:11
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HostNames

WebApp HostNames String Array

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-HttpLoggingEnabled

HttpLoggingEnabled Boolean

Parameter properties

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

Parameter sets

S1
Position:7
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HttpsOnly

Enable/disable redirecting all traffic to HTTPS on an existing azure webapp or functionapp

Parameter properties

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

Parameter sets

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

-ManagedPipelineMode

Managed Pipeline Mode Name

Parameter properties

Type:String
Default value:None
Accepted values:Classic, Integrated
Supports wildcards:False
DontShow:False

Parameter sets

S1
Position:12
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinTlsVersion

The minimum version of TLS required for SSL requests. Allowed Values [1.0 | 1.1 | 1.2].

Parameter properties

Type:String
Default value:None
Accepted values:1.0, 1.1, 1.2
Supports wildcards:False
DontShow:False

Parameter sets

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

-Name

WebApp Name

Parameter properties

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

Parameter sets

S1
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NetFrameworkVersion

Net Framework Version

Parameter properties

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

Parameter sets

S1
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NumberOfWorkers

The number of workers to be allocated

Parameter properties

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

Parameter sets

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

-PhpVersion

Php Version

Parameter properties

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

Parameter sets

S1
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RequestTracingEnabled

Request Tracing Enabled

Parameter properties

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

Parameter sets

S1
Position:6
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Resource Group Name

Parameter properties

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

Parameter sets

S1
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Use32BitWorkerProcess

Use 32-bit Worker Process Boolean

Parameter properties

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

Parameter sets

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

-WebApp

WebApp Object

Parameter properties

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

Parameter sets

S2
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WebSocketsEnabled

WebSocketsEnabled Boolean

Parameter properties

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

Parameter sets

S1
Position:13
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.

Inputs

Int32

String

PSSite

Outputs

PSSite

Notes

Below provided cmdlet will help you to update Azure Web App to DOTNETCORE $PropertiesObject = @{ "CURRENT_STACK" = "dotnetcore" } New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName "Default-Web-WestUS" -ResourceType Microsoft.Web/sites/config -ResourceName "ContosoWebApp/metadata" -ApiVersion 2018-02-01 -Force Replace the values of Default-Web-WestUS with your resource group name of the webapp and ContosoWebApp with the webapp name.