Skip to content

Commit 6a47cee

Browse files
author
maddieclayton
authored
Merge pull request #5286 from panchagnula/sisirap-stable-PremiumV2Fix
Fixes:5181: Set-AzureRmAppServicePlan errors out for a Premium V2 App
2 parents 3576e35 + 61f3254 commit 6a47cee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ResourceManager/Websites/Commands.Websites/Cmdlets/AppServicePlans/SetAzureAppServicePlan.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Azure.Commands.WebApps.Utilities;
1616
using Microsoft.Azure.Management.WebSites.Models;
1717
using System.Management.Automation;
18+
using System.Text.RegularExpressions;
1819

1920
#if NETSTANDARD
2021
using ServerFarmWithRichSku = Microsoft.Azure.Management.WebSites.Models.AppServicePlan;
@@ -58,7 +59,8 @@ public override void ExecuteCmdlet()
5859
AppServicePlan = WebsitesClient.GetAppServicePlan(ResourceGroupName, Name);
5960
AppServicePlan.Sku.Tier = string.IsNullOrWhiteSpace(Tier) ? AppServicePlan.Sku.Tier : Tier;
6061
AppServicePlan.Sku.Capacity = NumberofWorkers > 0 ? NumberofWorkers : AppServicePlan.Sku.Capacity;
61-
var workerSizeAsNumber = int.Parse(AppServicePlan.Sku.Name.Substring(1, AppServicePlan.Sku.Name.Length - 1));
62+
int workerSizeAsNumber = 0;
63+
int.TryParse(Regex.Match(AppServicePlan.Sku.Name, @"\d+").Value, out workerSizeAsNumber);
6264
AppServicePlan.Sku.Name = string.IsNullOrWhiteSpace(WorkerSize) ? CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, workerSizeAsNumber) : CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, WorkerSize);
6365
AppServicePlan.PerSiteScaling = PerSiteScaling;
6466
break;

0 commit comments

Comments
 (0)