Skip to content

Commit

Permalink
Realign naming of configuration settings #941 (#3041)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Sep 16, 2024
1 parent 4555ac0 commit f2a6ed5
Show file tree
Hide file tree
Showing 18 changed files with 166 additions and 76 deletions.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"agentpool",
"APIM",
"apiserver",
"APIVERSION",
"apiVersion",
"APPGW",
"Architected",
"AUDITIFNOTEXISTS",
Expand All @@ -62,7 +62,7 @@
"bicepparam",
"cmdlet",
"cmdlets",
"CODEOWNERS",
"codeowners",
"Concat",
"CONTAINERAPPS",
"Contoso",
Expand Down Expand Up @@ -90,6 +90,7 @@
"LESSOREQUAL",
"LESSOREQUALS",
"lifecycle",
"maxpods",
"MCSB",
"Newtonsoft",
"nics",
Expand Down
35 changes: 26 additions & 9 deletions docs/CHANGELOG-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers

- Issue #741: `Could not load file or assembly YamlDotNet`.
See [troubleshooting guide] for a workaround to this issue.
- The configuration option `Azure_AKSMinimumVersion` is replaced with `AZURE_AKS_CLUSTER_MINIMUM_VERSION`.
If you have this option configured, please update it to `AZURE_AKS_CLUSTER_MINIMUM_VERSION`.
Support for `Azure_AKSMinimumVersion` will be removed in v2.
See [upgrade notes][1] for more information.
- The configuration option `Azure_AllowedRegions` is replaced with `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
If you have this option configured, please update it to `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
Support for `Azure_AllowedRegions` will be removed in v2.
- The following configuration options are deprecated and have been replaced with alternative options.
If you have these options configured, please update them to the replacement.
Support for the old names will be removed in v2.
See [upgrade notes][1] for more information.
- `Azure_AKSMinimumVersion` is replaced with `AZURE_AKS_CLUSTER_MINIMUM_VERSION`.
- `Azure_AKSNodeMinimumMaxPods` is replaced with `AZURE_AKS_POOL_MINIMUM_MAXPODS`.
- `Azure_AllowedRegions` is replaced with `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
- `Azure_MinimumCertificateLifetime` is replaced with `AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME`.
- The `SupportsTag` PowerShell function has been replaced with the `Azure.Resource.SupportsTags` selector.
Update PowerShell rules to use the `Azure.Resource.SupportsTags` selector instead.
Support for the `SupportsTag` function will be removed in v2.
Expand All @@ -35,6 +35,23 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers
[#432](https://github.com/Azure/PSRule.Rules.Azure/issues/432)
- Verify that availability set members are in a backend pool by @BenjaminEngeset.
[#67](https://github.com/Azure/PSRule.Rules.Azure/issues/67)
- General improvements:
- **Important change:** Replaced the `Azure_AKSNodeMinimumMaxPods` option with `AZURE_AKS_POOL_MINIMUM_MAXPODS` by @BernieWhite.
[#941](https://github.com/Azure/PSRule.Rules.Azure/issues/941)
- For compatibility, if `Azure_AKSNodeMinimumMaxPods` is set it will be used instead of `AZURE_AKS_POOL_MINIMUM_MAXPODS`.
- If only `AZURE_AKS_POOL_MINIMUM_MAXPODS` is set, this value will be used.
- The default will be used neither options are configured.
- If `Azure_AKSNodeMinimumMaxPods` is set a warning will be generated until the configuration is removed.
- Support for `Azure_AKSNodeMinimumMaxPods` is deprecated and will be removed in v2.
- See [upgrade notes][1] for details.
- **Important change:** Replaced the `Azure_MinimumCertificateLifetime` option with `AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` by @BernieWhite.
[#941](https://github.com/Azure/PSRule.Rules.Azure/issues/941)
- For compatibility, if `Azure_MinimumCertificateLifetime` is set it will be used instead of `AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME`.
- If only `AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` is set, this value will be used.
- The default will be used neither options are configured.
- If `Azure_MinimumCertificateLifetime` is set a warning will be generated until the configuration is removed.
- Support for `Azure_MinimumCertificateLifetime` is deprecated and will be removed in v2.
- See [upgrade notes][1] for details.
- Bug fixed:
- Fixed `Azure.AppService.AvailabilityZone` only detects premium by tier property @BenjaminEngeset.
[#3034](https://github.com/Azure/PSRule.Rules.Azure/issues/3034)
Expand Down Expand Up @@ -1455,7 +1472,7 @@ What's changed since v1.29.0:
- Promoted `Azure.ContainerApp.DisableAffinity` to GA rule set by @BernieWhite.
[#2455](https://github.com/Azure/PSRule.Rules.Azure/issues/2455)
- General improvements:
- **Important change:** Replaced the `Azure_AllowedRegions` option with `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
- **Important change:** Replaced the `Azure_AllowedRegions` option with `AZURE_RESOURCE_ALLOWED_LOCATIONS` by @BernieWhite.
[#941](https://github.com/Azure/PSRule.Rules.Azure/issues/941)
- For compatibility, if `Azure_AllowedRegions` is set it will be used instead of `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
- If only `AZURE_RESOURCE_ALLOWED_LOCATIONS` is set, this value will be used.
Expand Down Expand Up @@ -1542,7 +1559,7 @@ What's changed since pre-release v1.30.0-B0080:
What's changed since pre-release v1.30.0-B0047:

- General improvements:
- **Important change:** Replaced the `Azure_AllowedRegions` option with `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
- **Important change:** Replaced the `Azure_AllowedRegions` option with `AZURE_RESOURCE_ALLOWED_LOCATIONS` by @BernieWhite.
[#941](https://github.com/Azure/PSRule.Rules.Azure/issues/941)
- For compatibility, if `Azure_AllowedRegions` is set it will be used instead of `AZURE_RESOURCE_ALLOWED_LOCATIONS`.
- If only `AZURE_RESOURCE_ALLOWED_LOCATIONS` is set, this value will be used.
Expand Down
57 changes: 29 additions & 28 deletions docs/concepts/about_PSRule_Azure_Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ For details of setting configuration options see [PSRule options][1].
The following configurations options are available for use:

- [AZURE_AKS_CLUSTER_MINIMUM_VERSION](#azure_aks_cluster_minimum_version)
- [Azure_AKSNodeMinimumMaxPods](#azure_aksnodeminimummaxpods)
- [Azure_AllowedRegions](#azure_allowedregions)
- [Azure_MinimumCertificateLifetime](#azure_minimumcertificatelifetime)
- [AZURE_AKS_POOL_MINIMUM_MAXPODS](#azure_aks_pool_minimum_maxpods)
- [AZURE_RESOURCE_ALLOWED_LOCATIONS](#azure_resource_allowed_locations)
- [AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME](#azure_apim_minimum_certificate_lifetime)
- [AZURE_PARAMETER_FILE_EXPANSION](#azure_parameter_file_expansion)
- [AZURE_POLICY_WAIVER_MAX_EXPIRY](#azure_policy_waiver_max_expiry)
- [AZURE_RESOURCE_GROUP](#azure_resource_group)
Expand All @@ -42,87 +42,88 @@ Syntax:

```yaml
configuration:
Azure_AKSMinimumVersion: string # A version string
AZURE_AKS_CLUSTER_MINIMUM_VERSION: string # A version string
```
Default:
```yaml
# YAML: The default Azure_AKSMinimumVersion configuration option
# YAML: The default AZURE_AKS_CLUSTER_MINIMUM_VERSION configuration option
configuration:
Azure_AKSMinimumVersion: 1.20.5
AZURE_AKS_CLUSTER_MINIMUM_VERSION: 1.20.5
```
Example:
```yaml
# YAML: Set the Azure_AKSMinimumVersion configuration option to 1.19.7
# YAML: Set the AZURE_AKS_CLUSTER_MINIMUM_VERSION configuration option to 1.19.7
configuration:
Azure_AKSMinimumVersion: 1.19.7
AZURE_AKS_CLUSTER_MINIMUM_VERSION: 1.19.7
```
### Azure_AKSNodeMinimumMaxPods
### AZURE_AKS_POOL_MINIMUM_MAXPODS
This configuration option determines the minimum allowed max pods setting per node pool.
When an AKS cluster node pool is created, a `maxPods` option is used to determine the maximum number of pods for each node in the node pool.
When an AKS cluster node pool is created,
a `maxPods` option is used to determine the maximum number of pods for each node in the node pool.

Syntax:

```yaml
configuration:
Azure_AKSNodeMinimumMaxPods: integer
AZURE_AKS_POOL_MINIMUM_MAXPODS: integer
```

Default:

```yaml
# YAML: The default Azure_AKSNodeMinimumMaxPods configuration option
# YAML: The default AZURE_AKS_POOL_MINIMUM_MAXPODS configuration option
configuration:
Azure_AKSNodeMinimumMaxPods: 50
AZURE_AKS_POOL_MINIMUM_MAXPODS: 50
```

Example:

```yaml
# YAML: Set the Azure_AKSNodeMinimumMaxPods configuration option to 30
# YAML: Set the AZURE_AKS_POOL_MINIMUM_MAXPODS configuration option to 30
configuration:
Azure_AKSNodeMinimumMaxPods: 30
AZURE_AKS_POOL_MINIMUM_MAXPODS: 30
```

### Azure_AllowedRegions
### AZURE_RESOURCE_ALLOWED_LOCATIONS

This configuration option specifies a list of allowed locations that resources can be deployed to.
Rules that check the location of Azure resources fail when a resource or resource group is created in a different region.

By default, `Azure_AllowedRegions` is not configured.
By default, `AZURE_RESOURCE_ALLOWED_LOCATIONS` is not configured.
The rule `Azure.Resource.AllowedRegions` is skipped when no allowed locations are configured.

Syntax:

```yaml
configuration:
Azure_AllowedRegions: array # An array of regions
AZURE_RESOURCE_ALLOWED_LOCATIONS: array # An array of regions
```

Default:

```yaml
# YAML: The default Azure_AllowedRegions configuration option
# YAML: The default AZURE_RESOURCE_ALLOWED_LOCATIONS configuration option
configuration:
Azure_AllowedRegions: []
AZURE_RESOURCE_ALLOWED_LOCATIONS: []
```

Example:

```yaml
# YAML: Set the Azure_AllowedRegions configuration option to Australia East, Australia South East
# YAML: Set the AZURE_RESOURCE_ALLOWED_LOCATIONS configuration option to Australia East, Australia South East
configuration:
Azure_AllowedRegions:
AZURE_RESOURCE_ALLOWED_LOCATIONS:
- 'australiaeast'
- 'australiasoutheast'
```

### Azure_MinimumCertificateLifetime
### AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME

This configuration option determines the minimum number of days allowed before certificate expiry.
Rules that check certificate lifetime fail when the days remaining before expiry drop below this number.
Expand All @@ -131,23 +132,23 @@ Syntax:

```yaml
configuration:
Azure_MinimumCertificateLifetime: integer
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: integer
```

Default:

```yaml
# YAML: The default Azure_MinimumCertificateLifetime configuration option
# YAML: The default AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME configuration option
configuration:
Azure_MinimumCertificateLifetime: 30
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: 30
```

Example:

```yaml
# YAML: Set the Azure_MinimumCertificateLifetime configuration option to 90
# YAML: Set the AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME configuration option to 90
configuration:
Azure_MinimumCertificateLifetime: 90
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: 90
```

### AZURE_PARAMETER_FILE_EXPANSION
Expand Down
4 changes: 2 additions & 2 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Until v2, the old option names are still work and will take precedence if new an
New name | Old name | Available from
-------- | -------- | --------------
`AZURE_AKS_CLUSTER_MINIMUM_VERSION` | `Azure_AKSMinimumVersion` | :octicons-milestone-24: v1.12.0
`AZURE_AKS_POOL_MINIMUM_MAXPODS` | `Azure_AKSNodeMinimumMaxPods` | _TBA - not available_
`AZURE_AKS_POOL_MINIMUM_MAXPODS` | `Azure_AKSNodeMinimumMaxPods` | :octicons-milestone-24: v1.39.0
`AZURE_RESOURCE_ALLOWED_LOCATIONS` | `Azure_AllowedRegions` | :octicons-milestone-24: v1.30.0
`AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` | `Azure_MinimumCertificateLifetime` | _TBA - not available_
`AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` | `Azure_MinimumCertificateLifetime` | :octicons-milestone-24: v1.39.0

!!! Note
Configuration options marked _TBA_ are not available yet.
Expand Down
4 changes: 2 additions & 2 deletions docs/en/rules/Azure.AKS.NodeMinPods.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ resource clusterWithPools 'Microsoft.ContainerService/managedClusters@2023-11-01

### Rule configuration

<!-- module:config rule Azure_AKSNodeMinimumMaxPods -->
<!-- module:config rule AZURE_AKS_POOL_MINIMUM_MAXPODS -->

By default, this rule fails when node pools have `maxPods` set to less than 50.
To configure this rule override the `Azure_AKSNodeMinimumMaxPods` configuration value with the minimum maxPods.
To configure this rule, override the `AZURE_AKS_POOL_MINIMUM_MAXPODS` configuration value with the minimum maxPods.

## LINKS

Expand Down
8 changes: 6 additions & 2 deletions docs/en/rules/Azure.APIM.CertificateExpiry.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ Consider renewing certificates before expiry to prevent service issues.

By default, this rule fails when certificates have less than 30 days remaining before expiry.

To configure this rule:
### Rule configuration

- Override the `Azure_MinimumCertificateLifetime` configuration value with the minimum number of days until expiry.
<!-- module:config rule AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME -->

By default, this rule fails if the days before a configured certificate expires is less than 30 days.
To configure this rule,
override the `AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` configuration value with the minimum number of days until expiry.

## LINKS

Expand Down
30 changes: 17 additions & 13 deletions docs/setup/configuring-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ configuration:
- AllMetrics
```

### Set the minimum MaxPods for a node pool
### AZURE_AKS_POOL_MINIMUM_MAXPODS

<!-- module:version v1.0.0 -->
<!-- module:version v1.39.0 -->
<!-- module:rule Azure.AKS.NodeMinPods -->

This configuration option determines the minimum allowed max pods setting per node pool.
When an AKS cluster node pool is created, a `maxPods` option is used to determine the maximum number of pods for each node in the node pool.
Expand All @@ -261,23 +262,23 @@ Syntax:

```yaml title="ps-rule.yaml"
configuration:
Azure_AKSNodeMinimumMaxPods: integer
AZURE_AKS_POOL_MINIMUM_MAXPODS: integer
```

Default:

```yaml title="ps-rule.yaml"
# YAML: The default Azure_AKSNodeMinimumMaxPods configuration option
# YAML: The default AZURE_AKS_POOL_MINIMUM_MAXPODS configuration option
configuration:
Azure_AKSNodeMinimumMaxPods: 50
AZURE_AKS_POOL_MINIMUM_MAXPODS: 50
```

Example:

```yaml title="ps-rule.yaml"
# YAML: Set the Azure_AKSNodeMinimumMaxPods configuration option to 30
# YAML: Set the AZURE_AKS_POOL_MINIMUM_MAXPODS configuration option to 30
configuration:
Azure_AKSNodeMinimumMaxPods: 30
AZURE_AKS_POOL_MINIMUM_MAXPODS: 30
```

### AZURE_AKS_CLUSTER_USER_POOL_MINIMUM_NODES
Expand Down Expand Up @@ -579,7 +580,10 @@ configuration:
location: australiaeast
```

### Azure_MinimumCertificateLifetime
### AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME

<!-- module:version v1.39.0 -->
<!-- module:rule Azure.APIM.CertificateExpiry -->

This configuration option determines the minimum number of days allowed before certificate expiry.
Rules that check certificate lifetime fail when the days remaining before expiry drop below this number.
Expand All @@ -588,23 +592,23 @@ Syntax:

```yaml title="ps-rule.yaml"
configuration:
Azure_MinimumCertificateLifetime: integer
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: integer
```

Default:

```yaml
# YAML: The default Azure_MinimumCertificateLifetime configuration option
# YAML: The default AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME configuration option
configuration:
Azure_MinimumCertificateLifetime: 30
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: 30
```

Example:

```yaml title="ps-rule.yaml"
# YAML: Set the Azure_MinimumCertificateLifetime configuration option to 90
# YAML: Set the AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME configuration option to 90
configuration:
Azure_MinimumCertificateLifetime: 90
AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME: 90
```

### AZURE_LINUX_OS_OFFERS
Expand Down
2 changes: 2 additions & 0 deletions docs/upgrade-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ To locate any configurations, search for the old option names within your Infras
New name | Old name | Available from
-------- | -------- | --------------
`AZURE_AKS_CLUSTER_MINIMUM_VERSION` | `Azure_AKSMinimumVersion` | :octicons-milestone-24: v1.12.0
`AZURE_AKS_POOL_MINIMUM_MAXPODS` | `Azure_AKSNodeMinimumMaxPods` | :octicons-milestone-24: v1.39.0
`AZURE_RESOURCE_ALLOWED_LOCATIONS` | `Azure_AllowedRegions` | :octicons-milestone-24: v1.30.0
`AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME` | `Azure_MinimumCertificateLifetime` | :octicons-milestone-24: v1.39.0

To update your configuration, use the new name instead.

Expand Down
4 changes: 3 additions & 1 deletion src/PSRule.Rules.Azure/en/PSRule-rules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
PremiumRedisCacheAvailabilityZone = "The premium redis cache ({0}) deployed to region ({1}) should use a minimum of two availability zones from the following [{2}]."
EnterpriseRedisCacheAvailabilityZone = "The enterprise redis cache ({0}) deployed to region ({1}) should be zone-redundant."
AKSMinimumVersionReplace = "The configuration option 'Azure_AKSMinimumVersion' has been replaced with 'AZURE_AKS_CLUSTER_MINIMUM_VERSION'. The option 'Azure_AKSMinimumVersion' is deprecated and will no longer work in the next major version. Please update your configuration to the new name. See https://aka.ms/ps-rule-azure/upgrade."
AKSNodeMinimumMaxPodsReplace = "The configuration option 'Azure_AKSNodeMinimumMaxPods' has been replaced with 'AZURE_AKS_POOL_MINIMUM_MAXPODS'. The option 'Azure_AKSNodeMinimumMaxPods' is deprecated and will no longer work in the next major version. Please update your configuration to the new name. See https://aka.ms/ps-rule-azure/upgrade."
AzureAllowedRegionsReplace = "The configuration option 'Azure_AllowedRegions' has been replaced with 'AZURE_RESOURCE_ALLOWED_LOCATIONS'. The option 'Azure_AllowedRegions' is deprecated and will no longer work in the next major version. Please update your configuration to the new name. See https://aka.ms/ps-rule-azure/upgrade."
APIMMinimumCertificateLifetimeReplace = "The configuration option 'Azure_MinimumCertificateLifetime' has been replaced with 'AZURE_APIM_MINIMUM_CERTIFICATE_LIFETIME'. The option 'Azure_MinimumCertificateLifetime' is deprecated and will no longer work in the next major version. Please update your configuration to the new name. See https://aka.ms/ps-rule-azure/upgrade."
# DeprecatedSupportsTags = "The 'SupportsTags' PowerShell function has been replaced with the selector 'Azure.Resource.SupportsTags'. The 'SupportsTags' function is deprecated and will no longer work in the next major version. Please update your PowerShell rules to the selector instead. See https://aka.ms/ps-rule-azure/upgrade."
KeyVaultAutoRotationPolicy = "The key ({0}) should enable a auto-rotation policy."
ReplicaNotFound = "A replica was not found."
Expand Down Expand Up @@ -122,4 +124,4 @@
VMSSPublicIPAttached = "The virtual machine scale set instances should not have public IP addresses directly attached to their network interfaces."
VMMultiTenantHostingRights = "The Windows 0S installed on the virtual machine ({0}) should use multi-tenant hosting rights."
VMAvailabilitySetDistributeTraffic = "The availability set member ({0}) should be a part of a backend pool."
}
}
Loading

0 comments on commit f2a6ed5

Please sign in to comment.