How to create an Azure web app using PowerShell

This Azure tutorial will discuss how to create an Azure web app using the PowerShell command New-AzWebApp and its syntax with examples.


New-AzWebApp is an excellent Azure PowerShell cmdlet that can help you quickly create an Azure Web App for a specified resource group, App Service Plan.

You need to specify key parameters along with this Azure PowerShell cmdlet, like name, resource group name, location, App Service Plan, etc.

Syntax of New-AzWebApp

The syntax of the New-AzWebApp Azure PowerShell cmdlet is as follows.

[[-ResourceGroupName] <String>]
 [-Name] <String>
 [[-Location] <String>]
   [[-AppServicePlan] <String>]
 [-ContainerImageName <String>]
[-GitRepositoryPath <String>]
[-DefaultProfile <IAzureContextContainer>]

New-AzWebApp Example

Let’s consider the below example. Here we will create an Azure Web App named “TSINFOSite” with the resource group name “Demo123”, Location is “East US”, and the App Service Plan as “TSINFOASP12”.

Execute the below Azure PowerShell Cmdlet.

PS C:\WINDOWS\system32> New-AzWebApp -ResourceGroupName Demo123 -Name "TSINFOSite" -Location "East US" -AppServicePlan "TSINFOASP12

Once you execute the above Azure PowerShell cmdlet, you will get the output like the one below

GitRemoteName               : 
GitRemoteUri                : 
GitRemoteUsername           : 
GitRemotePassword           : 
AzureStorageAccounts        : 
AzureStoragePath            : 
State                       : Running
HostNames                   : {}
RepositorySiteName          : TSINFOSite
UsageState                  : Normal
Enabled                     : True
EnabledHostNames            : {, 
AvailabilityState           : Normal
HostNameSslStates           : {, 
ServerFarmId                : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/reso
Reserved                    : False
IsXenon                     : False
HyperV                      : 
LastModifiedTimeUtc         : 6/25/2021 3:07:32 AM
SiteConfig                  : Microsoft.Azure.Management.WebSites.Models.SiteConfig
TrafficManagerHostNames     : 
ScmSiteAlsoStopped          : False
TargetSwapSlot              : 
HostingEnvironmentProfile   : 
ClientAffinityEnabled       : True
ClientCertEnabled           : False
ClientCertMode              : 
ClientCertExclusionPaths    : 
HostNamesDisabled           : False
CustomDomainVerificationId  : 
OutboundIpAddresses         :,,,,52.179
PossibleOutboundIpAddresses :,,,,52.179
ContainerSize               : 0
DailyMemoryTimeQuota        : 0
SuspendedTill               : 
MaxNumberOfWorkers          : 
CloningInfo                 : 
ResourceGroup               : Demo123
IsDefaultContainer          : 
DefaultHostName             :
SlotSwapStatus              : 
HttpsOnly                   : False
RedundancyMode              : 
InProgressOperationId       : 
Identity                    : 
Id                          : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/reso
Name                        : TSINFOSite
Kind                        : app
Location                    : East US
Type                        : Microsoft.Web/sites
Tags                        : 

You can see the same output in the below screenshot.



Publish-AzWebApp is an Azure PowerShell cmdlet that helps you upload content to an existing Azure Web App. The only thing is the content should be packaged in a ZIP file.

It helps you to deploy the Azure Web App from a ZIP or WAR file with the help of Zip deploy.


The Syntax of the Publish-AzWebApp Azure PowerShell cmdlet is as below

 -ArchivePath <String>
 [-ResourceGroupName] <String>
       [-Name] <String>
 [[-Slot] <String>]
[-DefaultProfile <IAzureContextContainer>]


PS C:\WINDOWS\system32> Publish-AzWebApp -ResourceGroupName Demo123 -Name TSINFOWebApp -ArchivePath C:\MyWork\

Once you execute the above Azure PowerShell cmdlet, it deploys the content inside the file to the web app named TSINFOWebApp, which belongs to the resource group Demo123.

Create Azure web app – Video Tutorial

You may like following the below Azure tutorials:


This Azure tutorial will discuss how to create an Azure web app using the PowerShell command New-AzWebApp.

I hope you have enjoyed this article !!!