0

I'm trying to deploy an app service plan (ASP) in the premium tier using powershell. I can deploy the ASP successfully but the ASP defaults to P2v1 which is not what I want. I need the ASP to be set to P2V2 in the premium tier.

I can't figure out or find how to specify the size when executing the powershell command. Here's my command:

New-AzAppServicePlan -Name $AppServicePlan -Location $location -ResourceGroupName $ResourceGroup -Tier "PremiumV2"

If somebody can explain how I can update my command so the ASP is set to Premium P2V2 I would greatly appreciate it.

jrd1989
  • 628
  • 10
  • 35
  • Are ARM Templates deployments via PowerShell an answer you want? Or is it pure PowerShell you are looking for? (ARM Template is best practice) – Elliot Huffman Oct 02 '20 at 18:17
  • 1
    As of now powershell is the preferred option im going with but its likely ARM templates will need to be included as a secondary option. This is for a client so I think they'll want both options available and working. – jrd1989 Oct 03 '20 at 19:36

2 Answers2

3

The PowerShell command for this is confusing for two reasons:

  1. The docs are missing the property you need for this, "WorkerSize"
  2. The values for this property don't line up with the actual sizes you want, they are listed as small, medium, large

The command you need to get a P2V2 plan is:

New-AzAppServicePlan -Name $AppServicePlan -Location $location -ResourceGroupName $ResourceGroup -Tier "PremiumV2" -WorkerSize Medium
Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • Adding "-WorkerSize Medium" to the end my command set the tier to P2V2 and stopped it from defaulting to P1V2. Thank you for the help and assistance with this! – jrd1989 Oct 05 '20 at 14:16
1

Try using -Tier "P2V2"

Failing that, it seems the PowerShell command doesn't support that SKU yet.

Their Azure CLI example supports SKUs, shown here https://docs.microsoft.com/en-us/azure/app-service/app-service-configure-premium-tier#automate-with-scripts

az appservice plan create \
    --resource-group <resource_group_name> \
    --name <app_service_plan_name> \
    --sku P1V2

You can use the SKU parameter in the generic New-AzResource to create the Azure resources directly using PowerShell the hard way.

Here's an example that you could tailor to your needs

New-AzResource -ResourceGroupName <ResourceGroupName> -Location <Location> -ResourceType Microsoft.Web/serverfarms -ResourceName <YourPlanName> -kind linux -Properties @{reserved="true"} -Sku @{name="S1";tier="Standard"; size="S1"; family="S"; capacity="1"} -Force

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
Garrett
  • 1,598
  • 4
  • 14
  • 25
  • Great answer! Could you update it to include the `Az` modules? The `AzureRM` modules are deprecated and new dev is not happening on them. – Elliot Huffman Oct 04 '20 at 14:52