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

[AppServices]: Fix #16325 and #14624 : Expose HealthCheckPath SiteConfig in Set-AzWebApp, Set-AzWebAppSlot, Get-AzWebApp and Get-AzWebAppSlot #17326

Merged
merged 7 commits into from
Mar 9, 2022
2 changes: 2 additions & 0 deletions src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ function Test-SetWebAppSlot
$slot.SiteConfig.RequestTracingEnabled = $true
$slot.SiteConfig.FtpsState = "FtpsOnly"
$slot.SiteConfig.MinTlsVersion = "1.0"
$slot.SiteConfig.HealthCheckPath = "/api/path"
Kotasudhakarreddy marked this conversation as resolved.
Show resolved Hide resolved

$slot = $slot | Set-AzWebAppSlot

Expand All @@ -471,6 +472,7 @@ function Test-SetWebAppSlot
Assert-AreEqual $true $slot.SiteConfig.RequestTracingEnabled
Assert-AreEqual "FtpsOnly" $slot.SiteConfig.FtpsState
Assert-AreEqual "1.0" $slot.SiteConfig.MinTlsVersion
Assert-AreEqual "/api/path" $slot.SiteConfig.HealthCheckPath

# set app settings and connection strings
$appSettings = @{ "setting1" = "valueA"; "setting2" = "valueB"}
Expand Down
2 changes: 2 additions & 0 deletions src/Websites/Websites.Test/ScenarioTests/WebAppTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,7 @@ function Test-SetWebApp
$webapp.SiteConfig.RequestTracingEnabled = $true
$webapp.SiteConfig.FtpsState = "FtpsOnly"
$webApp.SiteConfig.MinTlsVersion = "1.0"
$webApp.SiteConfig.HealthCheckPath = "/api/path"

# Set site properties
$webApp = $webApp | Set-AzWebApp
Expand All @@ -1252,6 +1253,7 @@ function Test-SetWebApp
Assert-AreEqual $false $webApp.SiteConfig.AlwaysOn
Assert-AreEqual "FtpsOnly" $webApp.SiteConfig.FtpsState
Assert-AreEqual "1.0" $webApp.SiteConfig.MinTlsVersion
Assert-AreEqual "/api/path" $webApp.SiteConfig.HealthCheckPath

$appSettings = @{ "setting1" = "valueA"; "setting2" = "valueB"}
$connectionStrings = @{ connstring1 = @{ Type="MySql"; Value="string value 1"}; connstring2 = @{ Type = "SQLAzure"; Value="string value 2"}}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed DateTime conversion issue caused by culture
* Fixed `Set-AzWebApp`,`Set-AzWebAppSlot`, `Get-AzWebApp`, `Get-AzWebAppSlot` to expose HealthCheckPath property in SiteConfig [#16325]
* Fixed DateTime conversion issue caused by culture [#17253]

## Version 2.10.0
* Updated `New-AzAppServicePlan` to create an app service plan with host environment id #16094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public class SetAzureWebAppSlotCmdlet : WebAppSlotBaseCmdlet
[ValidateNotNullOrEmpty]
public string[] HostNames { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Health Check Path", ParameterSetName = ParameterSet1Name)]
[ValidateNotNullOrEmpty]
public string HealthCheckPath { get; set; }


public override void ExecuteCmdlet()
{
Expand Down Expand Up @@ -182,7 +186,8 @@ public override void ExecuteCmdlet()
AutoSwapSlotName = parameters.Contains("AutoSwapSlotName") ? AutoSwapSlotName : null,
NumberOfWorkers = parameters.Contains("NumberOfWorkers") ? NumberOfWorkers : WebApp.SiteConfig.NumberOfWorkers,
AlwaysOn = parameters.Contains("AlwaysOn") ? (bool?)AlwaysOn : null,
FtpsState = parameters.Contains("FtpsState") ? FtpsState : WebApp.SiteConfig.FtpsState
FtpsState = parameters.Contains("FtpsState") ? FtpsState : WebApp.SiteConfig.FtpsState,
HealthCheckPath = parameters.Contains("HealthCheckPath") ? HealthCheckPath : WebApp.SiteConfig.HealthCheckPath
};
}

Expand Down
7 changes: 6 additions & 1 deletion src/Websites/Websites/Cmdlets/WebApps/SetAzureWebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public class SetAzureWebAppCmdlet : WebAppBaseCmdlet
[ValidateSet("AllAllowed", "Disabled", "FtpsOnly")]
public string FtpsState { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Health Check Path", ParameterSetName = ParameterSet1Name)]
[ValidateNotNullOrEmpty]
public string HealthCheckPath { get; set; }


public override void ExecuteCmdlet()
{
Expand Down Expand Up @@ -186,7 +190,8 @@ public override void ExecuteCmdlet()
NumberOfWorkers = parameters.Contains("NumberOfWorkers") ? NumberOfWorkers : WebApp.SiteConfig.NumberOfWorkers,
AlwaysOn = parameters.Contains("AlwaysOn") ? (bool?)AlwaysOn : null,
MinTlsVersion = parameters.Contains("MinTlsVersion") ? MinTlsVersion : WebApp.SiteConfig.MinTlsVersion,
FtpsState = parameters.Contains("FtpsState") ? FtpsState: WebApp.SiteConfig.FtpsState
FtpsState = parameters.Contains("FtpsState") ? FtpsState: WebApp.SiteConfig.FtpsState,
HealthCheckPath = parameters.Contains("HealthCheckPath") ? HealthCheckPath: WebApp.SiteConfig.HealthCheckPath
};
}

Expand Down
9 changes: 6 additions & 3 deletions src/Websites/Websites/Utilities/CmdletHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public static class CmdletHelpers
"NumberOfWorkers",
"AlwaysOn",
"MinTlsVersion",
"FtpsState"
"FtpsState",
"HealthCheckPath"
};

public static HashSet<string> SiteParameters = new HashSet<string>
Expand Down Expand Up @@ -513,7 +514,8 @@ internal static SiteConfigResource ConvertToSiteConfigResource(this SiteConfig c
WindowsFxVersion = config.WindowsFxVersion,
ManagedServiceIdentityId = config.ManagedServiceIdentityId,
MinTlsVersion = config.MinTlsVersion,
FtpsState = config.FtpsState
FtpsState = config.FtpsState,
HealthCheckPath = config.HealthCheckPath
};
}

Expand Down Expand Up @@ -569,7 +571,8 @@ internal static SiteConfig ConvertToSiteConfig(this SiteConfigResource config)
FtpsState = config.FtpsState,
ScmIpSecurityRestrictions = config.ScmIpSecurityRestrictions,
ScmIpSecurityRestrictionsUseMain = config.ScmIpSecurityRestrictionsUseMain,
Http20Enabled = config.Http20Enabled
Http20Enabled = config.Http20Enabled,
HealthCheckPath = config.HealthCheckPath
};
}

Expand Down
19 changes: 17 additions & 2 deletions src/Websites/Websites/help/Set-AzWebApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Set-AzWebApp [[-AppServicePlan] <String>] [[-DefaultDocuments] <String[]>] [[-Ne
[-ContainerRegistryUser <String>] [-ContainerRegistryPassword <SecureString>]
[-EnableContainerContinuousDeployment <Boolean>] [-HostNames <String[]>] [-NumberOfWorkers <Int32>] [-AsJob]
[-AssignIdentity <Boolean>] [-HttpsOnly <Boolean>] [-AzureStoragePath <WebAppAzureStoragePath[]>]
[-AlwaysOn <Boolean>] [-MinTlsVersion <String>] [-FtpsState <String>] [-ResourceGroupName] <String>
[-Name] <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
[-AlwaysOn <Boolean>] [-MinTlsVersion <String>] [-FtpsState <String>] [-HealthCheckPath <String>]
Kotasudhakarreddy marked this conversation as resolved.
Show resolved Hide resolved
[-ResourceGroupName] <String> [-Name] <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### S2
Expand Down Expand Up @@ -353,6 +353,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -HealthCheckPath
Container Image Name

```yaml
Type: System.String
Parameter Sets: S1
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -HostNames
WebApp HostNames String Array

Expand Down
19 changes: 17 additions & 2 deletions src/Websites/Websites/help/Set-AzWebAppSlot.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Set-AzWebAppSlot [[-AppServicePlan] <String>] [[-DefaultDocuments] <String[]>]
[-AutoSwapSlotName <String>] [-NumberOfWorkers <Int32>] [-ContainerImageName <String>]
[-ContainerRegistryUrl <String>] [-ContainerRegistryUser <String>] [-ContainerRegistryPassword <SecureString>]
[-EnableContainerContinuousDeployment <Boolean>] [-AsJob] [-AssignIdentity <Boolean>] [-HttpsOnly <Boolean>]
[-AzureStoragePath <WebAppAzureStoragePath[]>] [-AlwaysOn <Boolean>] [-MinTlsVersion <String>]
[-FtpsState <String>] [-ResourceGroupName] <String> [-Name] <String> [-Slot] <String>
[-AzureStoragePath <WebAppAzureStoragePath[]>] [-AlwaysOn <Boolean>] [-MinTlsVersion <String>]
[-HealthCheckPath <String>] [-FtpsState <String>] [-ResourceGroupName] <String> [-Name] <String> [-Slot] <String>
Kotasudhakarreddy marked this conversation as resolved.
Show resolved Hide resolved
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

Expand Down Expand Up @@ -341,6 +341,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -HealthCheckPath
Container Image Name

```yaml
Type: System.String
Parameter Sets: S1
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -HttpLoggingEnabled
HttpLoggingEnabled Boolean

Expand Down