diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index 574126718791..70cd5e2707a0 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -18,7 +18,11 @@ - Additional information about change #1 --> ## Upcoming Release +* updated `Set-AzAppServicePlan` to keep existing Tags when adding new Tags +* Fixed `Set-AzWebApp` to set the AppSettings +* updated `Set-AzWebAppSlot` to set FtpsState * Added support for StaticSites. + ## Version 2.5.0 * Updated `Add-AzWebAppAccessRestrictionRule` to allow all supported Service Tags and validate against Service Tag API. diff --git a/src/Websites/Websites/Cmdlets/AppServicePlans/SetAzureAppServicePlan.cs b/src/Websites/Websites/Cmdlets/AppServicePlans/SetAzureAppServicePlan.cs index c96248046af9..a1d2da8cdb7b 100644 --- a/src/Websites/Websites/Cmdlets/AppServicePlans/SetAzureAppServicePlan.cs +++ b/src/Websites/Websites/Cmdlets/AppServicePlans/SetAzureAppServicePlan.cs @@ -20,6 +20,7 @@ using Microsoft.Azure.Commands.WebApps.Models.WebApp; using System.Collections; using System.Collections.Generic; +using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.WebApps.Cmdlets.AppServicePlans { @@ -64,8 +65,11 @@ public override void ExecuteCmdlet() 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; - AppServicePlan.Tags = (IDictionary)CmdletHelpers.ConvertToStringDictionary(Tag); + AppServicePlan.PerSiteScaling = PerSiteScaling; + if (Tag != null && AppServicePlan.Tags!=null) + CmdletHelpers.ConvertToStringDictionary(Tag).ForEach(item => AppServicePlan.Tags?.Add(item)); + else + AppServicePlan.Tags = (IDictionary)CmdletHelpers.ConvertToStringDictionary(Tag); break; } diff --git a/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs b/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs index 86214ba6f841..5b2b7b2fccb7 100644 --- a/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs +++ b/src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs @@ -181,7 +181,8 @@ public override void ExecuteCmdlet() parameters.Contains("Use32BitWorkerProcess") ? (bool?)Use32BitWorkerProcess : null, AutoSwapSlotName = parameters.Contains("AutoSwapSlotName") ? AutoSwapSlotName : null, NumberOfWorkers = parameters.Contains("NumberOfWorkers") ? NumberOfWorkers : WebApp.SiteConfig.NumberOfWorkers, - AlwaysOn = parameters.Contains("AlwaysOn") ? (bool)AlwaysOn : false + AlwaysOn = parameters.Contains("AlwaysOn") ? (bool)AlwaysOn : false, + FtpsState = parameters.Contains("FtpsState") ? FtpsState : WebApp.SiteConfig.FtpsState }; } diff --git a/src/Websites/Websites/Utilities/WebsitesClient.cs b/src/Websites/Websites/Utilities/WebsitesClient.cs index ff9034f250c3..5abed9d36f13 100644 --- a/src/Websites/Websites/Utilities/WebsitesClient.cs +++ b/src/Websites/Websites/Utilities/WebsitesClient.cs @@ -513,21 +513,21 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location, if (useSlot) { - if (appSettings != null) + if (siteConfig != null) { - WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot( + WrappedWebsitesClient.WebApps().UpdateConfigurationSlot( resourceGroupName, webSiteName, - new StringDictionary { Properties = appSettings }, + siteConfig.ConvertToSiteConfigResource(), slotName); } - if (siteConfig != null) + if (appSettings != null) { - WrappedWebsitesClient.WebApps().UpdateConfigurationSlot( + WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot( resourceGroupName, webSiteName, - siteConfig.ConvertToSiteConfigResource(), + new StringDictionary { Properties = appSettings }, slotName); } @@ -552,6 +552,11 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location, else { + if (siteConfig != null) + { + WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource()); + } + if (appSettings != null) { WrappedWebsitesClient.WebApps().UpdateApplicationSettings( @@ -560,11 +565,6 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location, new StringDictionary { Properties = appSettings }); } - if (siteConfig != null) - { - WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource()); - } - if (connectionStrings != null) { WrappedWebsitesClient.WebApps().UpdateConnectionStrings(