Skip to content

Commit

Permalink
feat: Updated Azure.AppService.AvailabilityZone (#2987)
Browse files Browse the repository at this point in the history
Co-authored-by: Bernie White <bewhite@microsoft.com>
  • Loading branch information
BenjaminEngeset and BernieWhite authored Jul 13, 2024
1 parent 28aa13c commit 1c133e9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/PSRule.Rules.Azure/en/PSRule-rules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,4 @@
AzureSQLDatabaseMaintenanceWindow = "The {0} ({1}) should have a customer-controlled maintenance window configured."
ASEAvailabilityZoneVersion = "The app service environment ({0}) is not deployed with a version that supports zone-redundancy."
AppServiceAvailabilityZoneSKU = "The app service plan ({0}) is not deployed with a SKU that supports zone-redundancy."
AppServiceAvailabilityZone = "The app service plan ({0}) deployed to region ({1}) should use three availability zones from the following [{2}]."
}
7 changes: 1 addition & 6 deletions src/PSRule.Rules.Azure/rules/Azure.AppService.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,7 @@ Rule 'Azure.AppService.AvailabilityZone' -Ref 'AZR-000442' -Type 'Microsoft.Web/
$TargetObject.name
)

$Assert.HasFieldValue($TargetObject, 'properties.zoneRedundant', $true).Reason(
$LocalizedData.AppServiceAvailabilityZone,
$TargetObject.name,
$TargetObject.location,
($availabilityZones -join ', ')
)
$Assert.HasFieldValue($TargetObject, 'properties.zoneRedundant', $true)
}

#endregion Web Apps
Expand Down
4 changes: 2 additions & 2 deletions tests/PSRule.Rules.Azure.Tests/Azure.AppService.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ Describe 'Azure.AppService' -Tag 'AppService' {

$ruleResult[0].Reason | Should -BeExactly @(
"The app service plan (plan-A) is not deployed with a SKU that supports zone-redundancy."
"The app service plan (plan-A) deployed to region (eastus) should use three availability zones from the following [1, 2, 3]."
"Path properties.zoneRedundant: Does not exist."
);
$ruleResult[1].Reason | Should -BeExactly "The app service plan (plan-D) deployed to region (eastus) should use three availability zones from the following [1, 2, 3].";
$ruleResult[1].Reason | Should -BeExactly "Path properties.zoneRedundant: Is set to 'False'.";

# Pass
$ruleResult = @($filteredResult | Where-Object { $_.Outcome -eq 'Pass' });
Expand Down

0 comments on commit 1c133e9

Please sign in to comment.