You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by JonasCordsen December 5, 2023
Hello
I am trying to create a custom rule, that should match if a parameter I pass match the format for a subnet.
The parameter is an array. I am wondering if I am using it wrong, or this is something that is no support for yet
I have tested with a string, and that seems to work.
The parameter looks like this:
"Subnets": [
"172.16.0.0/24",
"172.16.1.0/24"
],
And the Rule looks like this
`
apiVersion: github.com/microsoft/PSRule/v1
kind: Rule
recommend: "VPN Local gateways onPremise network should be a subnet"
metadata:
name: "Local.YAML.localNetworkGateways.Subnet"
spec:
type:
- "Microsoft.Network/localNetworkGateways"
condition:
allOf:
- field: "properties.localNetworkAddressSpace.addressPrefixes"
isArray: true
- field: "properties.localNetworkAddressSpace.addressPrefixes"
match: '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/([1-3][0-2]$|[0-2][0-9]$|0?[0-9]$)'
`
The text was updated successfully, but these errors were encountered:
Discussed in #1687
Originally posted by JonasCordsen December 5, 2023
Hello
I am trying to create a custom rule, that should match if a parameter I pass match the format for a subnet.
The parameter is an array. I am wondering if I am using it wrong, or this is something that is no support for yet
I have tested with a string, and that seems to work.
The parameter looks like this:
"Subnets": [
"172.16.0.0/24",
"172.16.1.0/24"
],
And the Rule looks like this
`
apiVersion: github.com/microsoft/PSRule/v1
kind: Rule
recommend: "VPN Local gateways onPremise network should be a subnet"
metadata:
name: "Local.YAML.localNetworkGateways.Subnet"
spec:
type:
- "Microsoft.Network/localNetworkGateways"
condition:
allOf:
- field: "properties.localNetworkAddressSpace.addressPrefixes"
isArray: true
- field: "properties.localNetworkAddressSpace.addressPrefixes"
match: '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/([1-3][0-2]$|[0-2][0-9]$|0?[0-9]$)'
`
The text was updated successfully, but these errors were encountered: