Skip to content

Commit badf245

Browse files
[AppService]: fix #21820 Fixed Set-AzWebApp isue with Set-AzWebApp when piping in Get-AzWebApp object (#21973)
* [AppService]: fix #21820 Fixed Set-AzWebApp isue with `Set-AzWebApp` when piping in Get-AzWebApp object * Code changes are addressed * updated the code as per review comments
1 parent bfa82ee commit badf245

File tree

6 files changed

+3889
-3995
lines changed

6 files changed

+3889
-3995
lines changed

src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ function Test-SetWebAppSlot
446446
Assert-AreEqual $appWithSlotName $slot.Name
447447
Assert-AreEqual $serverFarm1.Id $slot.ServerFarmId
448448
Assert-Null $webApp.Identity
449-
Assert-AreEqual "AllAllowed" $slot.SiteConfig.FtpsState
449+
Assert-AreEqual "FtpsOnly" $slot.SiteConfig.FtpsState
450450

451451
# Change service plan & set site and SiteConfig properties
452452
$job = Set-AzWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $slotname -AppServicePlan $planName2 -HttpsOnly $true -AlwaysOn $true -AsJob
@@ -462,7 +462,7 @@ function Test-SetWebAppSlot
462462
# Set config properties
463463
$slot.SiteConfig.HttpLoggingEnabled = $true
464464
$slot.SiteConfig.RequestTracingEnabled = $true
465-
$slot.SiteConfig.FtpsState = "FtpsOnly"
465+
$slot.SiteConfig.FtpsState = "AllAllowed"
466466
$slot.SiteConfig.MinTlsVersion = "1.0"
467467
$slot.SiteConfig.HealthCheckPath = "/api/path"
468468

@@ -473,7 +473,7 @@ function Test-SetWebAppSlot
473473
Assert-AreEqual $serverFarm2.Id $slot.ServerFarmId
474474
Assert-AreEqual $true $slot.SiteConfig.HttpLoggingEnabled
475475
Assert-AreEqual $true $slot.SiteConfig.RequestTracingEnabled
476-
Assert-AreEqual "FtpsOnly" $slot.SiteConfig.FtpsState
476+
Assert-AreEqual "AllAllowed" $slot.SiteConfig.FtpsState
477477
Assert-AreEqual "1.0" $slot.SiteConfig.MinTlsVersion
478478
Assert-AreEqual "/api/path" $slot.SiteConfig.HealthCheckPath
479479

@@ -524,7 +524,7 @@ function Test-SetWebAppSlot
524524
# Assert
525525
Assert-AreEqual $appWithSlotName $slot.Name
526526
Assert-Null $webApp.Identity
527-
Assert-AreEqual "AllAllowed" $slot.SiteConfig.FtpsState
527+
Assert-AreEqual "FtpsOnly" $slot.SiteConfig.FtpsState
528528

529529
# Get the deployment slot
530530

@@ -533,7 +533,7 @@ function Test-SetWebAppSlot
533533
# Set config properties
534534
$slot.SiteConfig.HttpLoggingEnabled = $true
535535
$slot.SiteConfig.RequestTracingEnabled = $true
536-
$slot.SiteConfig.FtpsState = "FtpsOnly"
536+
$slot.SiteConfig.FtpsState = "AllAllowed"
537537
$slot.SiteConfig.MinTlsVersion = "1.0"
538538

539539
$slot = $slot | Set-AzWebAppSlot
@@ -542,7 +542,7 @@ function Test-SetWebAppSlot
542542
Assert-AreEqual $appWithSlotName $slot.Name
543543
Assert-AreEqual $true $slot.SiteConfig.HttpLoggingEnabled
544544
Assert-AreEqual $true $slot.SiteConfig.RequestTracingEnabled
545-
Assert-AreEqual "FtpsOnly" $slot.SiteConfig.FtpsState
545+
Assert-AreEqual "AllAllowed" $slot.SiteConfig.FtpsState
546546
Assert-AreEqual "1.0" $slot.SiteConfig.MinTlsVersion
547547
}
548548
finally

src/Websites/Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ function Test-SetWebApp
934934
Assert-Null $webApp.Identity
935935
Assert-NotNull $webApp.SiteConfig.phpVersion
936936
Assert-AreEqual $false $webApp.HttpsOnly
937-
Assert-AreEqual "AllAllowed" $webApp.SiteConfig.FtpsState
937+
Assert-AreEqual "FtpsOnly" $webApp.SiteConfig.FtpsState
938938

939939
# Change service plan & set site properties
940940
$job = Set-AzWebApp -ResourceGroupName $rgname -Name $webAppName -AppServicePlan $appServicePlanName2 -HttpsOnly $true -AlwaysOn $false -AsJob
@@ -952,7 +952,7 @@ function Test-SetWebApp
952952
# Set config properties
953953
$webapp.SiteConfig.HttpLoggingEnabled = $true
954954
$webapp.SiteConfig.RequestTracingEnabled = $true
955-
$webapp.SiteConfig.FtpsState = "FtpsOnly"
955+
$webapp.SiteConfig.FtpsState = "AllAllowed"
956956
$webApp.SiteConfig.MinTlsVersion = "1.0"
957957
$webApp.SiteConfig.HealthCheckPath = "/api/path"
958958

@@ -967,7 +967,7 @@ function Test-SetWebApp
967967
Assert-AreEqual $true $webApp.SiteConfig.HttpLoggingEnabled
968968
Assert-AreEqual $true $webApp.SiteConfig.RequestTracingEnabled
969969
Assert-AreEqual $false $webApp.SiteConfig.AlwaysOn
970-
Assert-AreEqual "FtpsOnly" $webApp.SiteConfig.FtpsState
970+
Assert-AreEqual "AllAllowed" $webApp.SiteConfig.FtpsState
971971
Assert-AreEqual "1.0" $webApp.SiteConfig.MinTlsVersion
972972
Assert-AreEqual "/api/path" $webApp.SiteConfig.HealthCheckPath
973973

src/Websites/Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestSetWebAppSlot.json

Lines changed: 1768 additions & 1711 deletions
Large diffs are not rendered by default.

src/Websites/Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestSetWebApp.json

Lines changed: 2107 additions & 2275 deletions
Large diffs are not rendered by default.

src/Websites/Websites/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Increased timeout for Publish-AzWebApp command
22+
* Fixed Set-AzWebApp isue with `Set-AzWebApp` when piping in Get-AzWebApp object [#21820]
2223

2324
## Version 3.0.0
2425
* Removed `New-AzWebAppContainerPSSession` and `Enter-AzWebAppContainerPSSession` cmdlets

src/Websites/Websites/Utilities/WebsitesClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public void UpdateWebApp(string resourceGroupName, string location, string webAp
112112

113113
if (siteEnvelope != null)
114114
{
115+
if (siteEnvelope is PSSite)
116+
{
117+
((PSSite)siteEnvelope).VnetInfo = null;
118+
}
115119
webSiteToUpdate = siteEnvelope;
116120
}
117121

0 commit comments

Comments
 (0)