Azure / Azure/PSRule.Rules.Azure

Application gateway: properties.redirectConfiguration.properties check

Open
#1,522 2 comments 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.