Azure PowerShell Cmdlets

Set-AzWebApp

Updates an existing Azure Web App resource.

Syntax

Set-AzWebApp
   -ResourceGroupName <String>
   -Name <String>
   [-AppServicePlan <String>]
   [-Location <String>]
   [-HttpsOnly <Boolean>]
   [-ClientAffinityEnabled <Boolean>]
   [-DefaultHostName <String>]
   [-Force]
   [-WhatIf]
   [-Confirm]

Parameters

ParameterTypeDescription
-ResourceGroupNameStringName of the resource group containing the Web App.
-NameStringName of the Web App to update.
-AppServicePlanStringNew or existing App Service plan to associate.
-LocationStringAzure region (e.g., westus2).
-HttpsOnlyBooleanEnable HTTPS‑only traffic when $true.
-ClientAffinityEnabledBooleanEnable sticky sessions when $true.
-DefaultHostNameStringCustom host name to set as the default.
-ForceSwitchSuppress confirmation prompts.
-WhatIfSwitchShows what would happen if the cmdlet runs.
-ConfirmSwitchPrompts for confirmation before executing.

Examples

1. Update the App Service plan of a Web App

Set-AzWebApp -ResourceGroupName "MyRG" -Name "MyWebApp" -AppServicePlan "MyNewPlan"

2. Enable HTTPS‑only

Set-AzWebApp -ResourceGroupName "MyRG" -Name "MyWebApp" -HttpsOnly $true

3. Change the default host name

Set-AzWebApp -ResourceGroupName "MyRG" -Name "MyWebApp" -DefaultHostName "custom.domain.com"

Related Cmdlets