Azure / PSRule.Rules.Azure

Rules to validate Azure resources and infrastructure as code (IaC) using PSRule.
https://azure.github.io/PSRule.Rules.Azure/
MIT License
394 stars 86 forks source link

Azure.APIM.HTTPBackend flags FAIL when no API/backend is connected (yet) #1929

Closed MarcelHeek closed 1 year ago

MarcelHeek commented 1 year ago

Description of the issue

I have an environment where API Management is enabled without any API (backend) connected yet. This configuration is deployed via IaC (terraform)

To Reproduce

Steps to reproduce the issue:

Expected behaviour

I would expect that an unconfigured API Management resource without any API pr backend configures would pass this rule

Error output

N/A

Module in use and version:

Captured output from $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.25252
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional context

BernieWhite commented 1 year ago

@MarcelHeek Thanks for reporting the issue.

Has the serviceUrl (reported as Web Service URL within the portal under API > Settings) property been populated at all?

This is the default backend when a backend has not been specified.

The rule should be checking either backend URL or service URL because both are treated as the backend depending on the configuration.

MarcelHeek commented 1 year ago

@BernieWhite

I am not into the APIM stuff, so I could not find in the portal what you are referring to, but I found this item that probably flags the rule to FAIL. Wonder how that got in there as it was not in the terraform code, I will ask co-worker for that, but I guess you can tell me whether this could be the smoking gun for the FAIL result?

image

BernieWhite commented 1 year ago

@MarcelHeek Yep that is the website service URL which is part of the check and this will cause the rule to fail.

MarcelHeek commented 1 year ago

Thanks for confirming this. This API appears to be default created for every APIM resource deployed. So right off the bat this will be flagged als FAIL

BernieWhite commented 1 year ago

Thanks @MarcelHeek we can add an additional note to the docs on that point.