New-AzAppServicePlan PowerShell Cmdlets with example

New-AzAppServicePlan is used to create an app service plan in Microsoft Azure in a specific Geo location. In this tutorial, I will explain how to use New-AzAppServicePlan PowerShell cmdlets with an example.

New-AzAppServicePlan

New-AzAppServicePlan is a useful Azure PowerShell cmdlet that can help you quickly create an App service plan for a specific region in Azure.

You need to specify a few parameters: name, location, tier, number of workers, worker size, etc.

Syntax of New-AzAppServicePlan

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

New-AzAppServicePlan
 [-Location] <String>
 [[-Tier] <String>]
[[-NumberofWorkers] <Int32>]
[[-WorkerSize] <String>]
[[-AseName] <String>]
[[-AseResourceGroupName] <String>]
[-AppServicePlan] <PSAppServicePlan>

Example – Create a new app service plan

Here is an example how to use the New-AzAppServicePlan cmdlet to create a new service plan.

PS C:\WINDOWS\system32> New-AzAppServicePlan -ResourceGroupName "Demo123" -Name "TSINFOASP12" -Location "East US" -Tier "Basic" -NumberofWorkers 2 -WorkerSize "Small"

Once you run the above command, it will create an App Service plan named “TSINFOASP12” with the resource group name “Demo123“, Location is “East US”, Tier is “Basic“, Number of workers is 2and the worker size is “Small“.

You can see the output below:

AdminSiteName             : 
WorkerTierName            : 
Status                    : Ready
Subscription              : 1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
HostingEnvironmentProfile : 
MaximumNumberOfWorkers    : 0
GeoRegion                 : East US
PerSiteScaling            : False
MaximumElasticWorkerCount : 
NumberOfSites             : 0
IsSpot                    : False
SpotExpirationTime        : 
FreeOfferExpirationTime   : 
ResourceGroup             : Demo123
Reserved                  : False
IsXenon                   : False
HyperV                    : 
TargetWorkerCount         : 0
TargetWorkerSizeId        : 0
ProvisioningState         : Succeeded
Sku                       : Microsoft.Azure.Management.WebSites.Models.SkuDescription
Id                        : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resour
                            ceGroups/Demo123/providers/Microsoft.Web/serverfarms/TSINF
                            OASP12
Name                      : TSINFOASP12
Kind                      : app
Location                  : East US
Type                      : Microsoft.Web/serverfarms
Tags                      : 

You can see the screenshot below that runs in the system using PowerShell ISE.

New-AzAppServicePlan

You can also verify from the Azure portal. For this, log in to the Azure Portal and search for the App Service plan name in the search box. You can able to see the App Service Plan has been created successfully.

Create App Service Plan Azure PowerShell

Conclusion

Here, we saw how to create a new app service plan using the New-AzAppServicePlan PowerShell command. I have also explained the syntax and run the complete script using PowerShell ISE.

You may also like: