Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
May 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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.

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

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

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