Azure / Azure/PSRule.Rules.Azure
Application gateway: properties.redirectConfiguration.properties check
- Dominant language
- PowerShell
- Stars
- 447
- Forks
- 109
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 23
Description
**Description of the issue**
I think there should be a check on properties as well:
```powershell
Rule 'Azure.AppGw.UseHTTPS' -Ref 'AZR-000059' -Type 'Microsoft.Network/applicationGateways' -Tag @{ release = 'GA'; ruleSet = '2021_09'; } {
$listeners = @($TargetObject.properties.httpListeners | Where-Object { $_.properties.protocol -eq 'http' });
$requestRoutingRules = @($TargetObject.properties.requestRoutingRules);
if ($listeners.Length -eq 0 -or $requestRoutingRules.Length -eq 0) {
return $Assert.Pass();
}
foreach ($requestRoutingRule in $requestRoutingRules) {
$listener = $listeners | Where-Object { $_.name -eq $requestRoutingRule.properties.httpListener.id.Split('/')[-1] };
if ($Null -eq $listener) {
$Assert.Pass();
}
else {
$Assert.HasFieldValue($requestRoutingRule, 'properties.redirectConfiguration.id');
}
elseif {
$Assert.HasFieldValue($requestRoutingRule, 'properties.redirectConfiguration.properties');
}
}
}
```
**Module in use and version:**
- Module: PSRule.Rules.Azure
- Version: **[e.g. 1.17.1]**
Captured output from `$PSVersionTable`:
```text
```
**Additional context**
Contributor guide
Assessment
This issue has not been assessed yet.