public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            switch (ParameterSetName)
            {
            case ParameterSet1Name:
                AppServicePlan              = new PSAppServicePlan(WebsitesClient.GetAppServicePlan(ResourceGroupName, Name));
                AppServicePlan.Sku.Tier     = string.IsNullOrWhiteSpace(Tier) ? AppServicePlan.Sku.Tier : Tier;
                AppServicePlan.Sku.Capacity = NumberofWorkers > 0 ? NumberofWorkers : AppServicePlan.Sku.Capacity;
                int workerSizeAsNumber = 0;
                int.TryParse(Regex.Match(AppServicePlan.Sku.Name, @"\d+").Value, out workerSizeAsNumber);
                AppServicePlan.Sku.Name       = string.IsNullOrWhiteSpace(WorkerSize) ? CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, workerSizeAsNumber) : CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, WorkerSize);
                AppServicePlan.PerSiteScaling = PerSiteScaling;
                if (Tag != null && AppServicePlan.Tags != null)
                {
                    CmdletHelpers.ConvertToStringDictionary(Tag).ForEach(item => AppServicePlan.Tags?.Add(item));
                }
                else
                {
                    AppServicePlan.Tags = (IDictionary <string, string>)CmdletHelpers.ConvertToStringDictionary(Tag);
                }
                break;
            }

            // Fix Server Farm SKU description
            AppServicePlan.Sku.Size   = AppServicePlan.Sku.Name;
            AppServicePlan.Sku.Family = AppServicePlan.Sku.Name.Substring(0, 1);

            WriteObject(new PSAppServicePlan(WebsitesClient.CreateOrUpdateAppServicePlan(ResourceGroupName, Name, AppServicePlan)), true);
        }
        public override void ExecuteCmdlet()
        {
            if (HyperV.IsPresent &&
                (Tier != "PremiumContainer" && Tier != "PremiumV3"))
            {
                throw new Exception("HyperV switch is only allowed for PremiumContainer or PremiumV3 tiers");
            }
            if (!HyperV.IsPresent && Tier == "PremiumContainer")
            {
                throw new Exception("PremiumContainer tier is only allowed if HyperV switch is present");
            }

            if (string.IsNullOrWhiteSpace(Tier))
            {
                Tier = "Free";
            }

            if (string.IsNullOrWhiteSpace(WorkerSize))
            {
                WorkerSize = "Small";
            }

            var aseResourceGroupName = AseResourceGroupName;

            if (!string.IsNullOrEmpty(AseName) &&
                string.IsNullOrEmpty(aseResourceGroupName))
            {
                aseResourceGroupName = ResourceGroupName;
            }

            var capacity = NumberofWorkers < 1 ? 1 : NumberofWorkers;
            var skuName  = CmdletHelpers.GetSkuName(Tier, WorkerSize);

            var sku = new SkuDescription
            {
                Tier     = Tier,
                Name     = skuName,
                Capacity = capacity
            };

            var appServicePlan = new AppServicePlan
            {
                Location       = Location,
                Sku            = sku,
                PerSiteScaling = PerSiteScaling,
                IsXenon        = HyperV.IsPresent,
                Tags           = (IDictionary <string, string>)CmdletHelpers.ConvertToStringDictionary(Tag),
                Reserved       = Linux.IsPresent
            };

            AppServicePlan   retPlan = WebsitesClient.CreateOrUpdateAppServicePlan(ResourceGroupName, Name, appServicePlan, AseName, aseResourceGroupName);
            PSAppServicePlan psPlan  = new PSAppServicePlan(retPlan);

            WriteObject(psPlan, true);
        }