New-AzWebApp

New-AzWebApp

Creates a new Azure App Service web app.

This cmdlet creates a new App Service web app in Azure. You can specify the resource group, name, location, operating system, and plan for the web app.

Syntax

New-AzWebApp [-Name] <String> [-ResourceGroupName] <String> [-Location] <String> [-AppServicePlan] <String> [-OsType] <OperatingSystemTypes> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]

Parameters

Name Type Description
-Name String The name of the web app to create. The name must be globally unique.
-ResourceGroupName String The name of the resource group to which the web app belongs.
-Location String The Azure region where the web app will be created. Examples: "East US", "West Europe".
-AppServicePlan String The name of the App Service plan. The web app will be associated with this plan.
-OsType OperatingSystemTypes The operating system of the web app. Valid values are 'Windows' and 'Linux'.
-DefaultProfile IAzureContextContainer The credentials, account, tenant, and subscription that are used for communication with Azure.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.

Examples

Example 1: Create a Windows Web App

New-AzWebApp -Name "mywindowswapp" -ResourceGroupName "myResourceGroup" -Location "East US" -AppServicePlan "myAppServicePlan" -OsType "Windows"

Example 2: Create a Linux Web App

New-AzWebApp -Name "myminuxwebapp" -ResourceGroupName "myResourceGroup" -Location "West Europe" -AppServicePlan "myLinuxAppServicePlan" -OsType "Linux"

Example 3: Create a Web App with confirmation

New-AzWebApp -Name "anotherwebapp" -ResourceGroupName "anotherRG" -Location "Central US" -AppServicePlan "standardPlan" -OsType "Windows" -Confirm