microsoft / PSRule.Rules.CAF

A suite of rules to validate Azure resources against the Cloud Adoption Framework (CAF) using PSRule.
MIT License
62 stars 15 forks source link

CAF.Name.PublicIP logic needs tweaking #98

Open Gordonby opened 2 years ago

Gordonby commented 2 years ago

Description of the issue

I don't believe the logic or message around public ip's is correct. (Happy to be wrong through).

My template fails with;

-> pip-agw-byo : Microsoft.Network/publicIPAddresses [3/4]

    [PASS] Azure.PublicIP.Name
    [PASS] Azure.PublicIP.AvailabilityZone
    [PASS] Azure.PublicIP.StandardSKU
    [FAIL] CAF.Name.PublicIP
    | Template: bicep/main.bicep:991:5
    | Parameter: .github/workflows_dep/AksDeploy-ByoVnet.parameters.json:1:0

    | RECOMMEND:
    | Consider creating public IPs with a standard name. Additionally consider using
    | Azure Policy to only permit creation using a standard naming convention.

    | REASON:
    | - The parameter 'prefix' is null.

    | HELP:
    | - https://github.com/microsoft/PSRule.Rules.CAF/blob/main/docs/rules/en/CAF.Name.PublicIP.md

Error: pip-agw-byo failed CAF.Name.PublicIP. Public IP address names should use a standard prefix.
  1. The parameter 'prefix' is null - I don't see prefix in the RP schema.
  2. Hoping it doesn't mean publicIPPrefix as that has another purpose, not naming.
  3. This PublicIP address is created with the name pip-agw-byo - which should already be CAF compliant.
BernieWhite commented 2 years ago

@Gordonby Thanks for reporting this issue. Yes. Looks like a bug. Double-checking your linked GitHub action results it does not appear that you are overriding the CAF_PublicIPPrefix configuration option so it should just work.