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
| Parameter | Type | Description |
|---|---|---|
| -ResourceGroupName | String | Name of the resource group containing the Web App. |
| -Name | String | Name of the Web App to update. |
| -AppServicePlan | String | New or existing App Service plan to associate. |
| -Location | String | Azure region (e.g., westus2). |
| -HttpsOnly | Boolean | Enable HTTPS‑only traffic when $true. |
| -ClientAffinityEnabled | Boolean | Enable sticky sessions when $true. |
| -DefaultHostName | String | Custom host name to set as the default. |
| -Force | Switch | Suppress confirmation prompts. |
| -WhatIf | Switch | Shows what would happen if the cmdlet runs. |
| -Confirm | Switch | Prompts 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"