Skip to content

Commit

Permalink
Fixes: #14884: Set-AzWebAppSlot to set FtpsState, #14998:`Set-AzWeb… (
Browse files Browse the repository at this point in the history
#15011)

* Fixes: #14884: `Set-AzWebAppSlot` to set FtpsState, #14998:`Set-AzWebApp` to set the AppSettings, #15005: `Set-AzAppServicePlan` to keep existing Tags when adding new Tags

* Build issue fixed

* Update ChangeLog.md

* Build fix

Co-authored-by: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com>
  • Loading branch information
Kotasudhakarreddy and wyunchi-ms committed May 18, 2021
1 parent 0550d0e commit e72676a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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<string, string>)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<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down
22 changes: 11 additions & 11 deletions src/Websites/Websites/Utilities/WebsitesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit e72676a

Please sign in to comment.