Skip to content

Commit e3a2249

Browse files
Fixes: #14884: Set-AzWebAppSlot to set FtpsState, #14998:`Set-AzWeb… (#15011) (#15055)
* 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 <[email protected]> Co-authored-by: Kota Sudhakar Reddy <[email protected]>
1 parent f9f2fa5 commit e3a2249

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

src/Websites/Websites/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* updated `Set-AzAppServicePlan` to keep existing Tags when adding new Tags
22+
* Fixed `Set-AzWebApp` to set the AppSettings
23+
* updated `Set-AzWebAppSlot` to set FtpsState
2124
* Added support for StaticSites.
25+
2226
## Version 2.5.0
2327
* Updated `Add-AzWebAppAccessRestrictionRule` to allow all supported Service Tags and validate against Service Tag API.
2428

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Microsoft.Azure.Commands.WebApps.Models.WebApp;
2121
using System.Collections;
2222
using System.Collections.Generic;
23+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2324

2425
namespace Microsoft.Azure.Commands.WebApps.Cmdlets.AppServicePlans
2526
{
@@ -64,8 +65,11 @@ public override void ExecuteCmdlet()
6465
int workerSizeAsNumber = 0;
6566
int.TryParse(Regex.Match(AppServicePlan.Sku.Name, @"\d+").Value, out workerSizeAsNumber);
6667
AppServicePlan.Sku.Name = string.IsNullOrWhiteSpace(WorkerSize) ? CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, workerSizeAsNumber) : CmdletHelpers.GetSkuName(AppServicePlan.Sku.Tier, WorkerSize);
67-
AppServicePlan.PerSiteScaling = PerSiteScaling;
68-
AppServicePlan.Tags = (IDictionary<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag);
68+
AppServicePlan.PerSiteScaling = PerSiteScaling;
69+
if (Tag != null && AppServicePlan.Tags!=null)
70+
CmdletHelpers.ConvertToStringDictionary(Tag).ForEach(item => AppServicePlan.Tags?.Add(item));
71+
else
72+
AppServicePlan.Tags = (IDictionary<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag);
6973
break;
7074
}
7175

src/Websites/Websites/Cmdlets/DeploymentSlots/SetAzureWebAppSlot.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public override void ExecuteCmdlet()
181181
parameters.Contains("Use32BitWorkerProcess") ? (bool?)Use32BitWorkerProcess : null,
182182
AutoSwapSlotName = parameters.Contains("AutoSwapSlotName") ? AutoSwapSlotName : null,
183183
NumberOfWorkers = parameters.Contains("NumberOfWorkers") ? NumberOfWorkers : WebApp.SiteConfig.NumberOfWorkers,
184-
AlwaysOn = parameters.Contains("AlwaysOn") ? (bool)AlwaysOn : false
184+
AlwaysOn = parameters.Contains("AlwaysOn") ? (bool)AlwaysOn : false,
185+
FtpsState = parameters.Contains("FtpsState") ? FtpsState : WebApp.SiteConfig.FtpsState
185186
};
186187
}
187188

src/Websites/Websites/Utilities/WebsitesClient.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -513,21 +513,21 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location,
513513
if (useSlot)
514514
{
515515

516-
if (appSettings != null)
516+
if (siteConfig != null)
517517
{
518-
WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot(
518+
WrappedWebsitesClient.WebApps().UpdateConfigurationSlot(
519519
resourceGroupName,
520520
webSiteName,
521-
new StringDictionary { Properties = appSettings },
521+
siteConfig.ConvertToSiteConfigResource(),
522522
slotName);
523523
}
524524

525-
if (siteConfig != null)
525+
if (appSettings != null)
526526
{
527-
WrappedWebsitesClient.WebApps().UpdateConfigurationSlot(
527+
WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot(
528528
resourceGroupName,
529529
webSiteName,
530-
siteConfig.ConvertToSiteConfigResource(),
530+
new StringDictionary { Properties = appSettings },
531531
slotName);
532532
}
533533

@@ -552,6 +552,11 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location,
552552
else
553553
{
554554

555+
if (siteConfig != null)
556+
{
557+
WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource());
558+
}
559+
555560
if (appSettings != null)
556561
{
557562
WrappedWebsitesClient.WebApps().UpdateApplicationSettings(
@@ -560,11 +565,6 @@ public void UpdateWebAppConfiguration(string resourceGroupName, string location,
560565
new StringDictionary { Properties = appSettings });
561566
}
562567

563-
if (siteConfig != null)
564-
{
565-
WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource());
566-
}
567-
568568
if (connectionStrings != null)
569569
{
570570
WrappedWebsitesClient.WebApps().UpdateConnectionStrings(

0 commit comments

Comments
 (0)