Question about Azure.APIM.PolicyBase Rule and <base /> Element #3412
-
Hi everyone 👋 I'm running into an issue with the Azure.APIM.PolicyBase rule. From the documentation, I understand that I need to include the element in every scope of the policy, which I’ve done. However, I’m still getting the following error:
I'm loading my XML files using loadTextContent('./api-policy.xml'), but I don’t believe that’s the issue, as I’ve also tried passing the policy directly as a string with the same result. Any insights or suggestions on what might be causing this would be greatly appreciated! 🎉 Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @mikkelh-SDU Thanks for the question. I think the problem would be that your policy is missing one or more of the sections That's not specifically called out in the documentation, although the example includes it. But that could easily be a point of confusion, so we should add it. #3413 Try adding the missing sections and inherit them from base. I hope that helps. |
Beta Was this translation helpful? Give feedback.
Hi @mikkelh-SDU Thanks for the question.
I think the problem would be that your policy is missing one or more of the sections
inbound
,backend
,outbound
, oron-error
.That's not specifically called out in the documentation, although the example includes it. But that could easily be a point of confusion, so we should add it. #3413
https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/rules/Azure.APIM.Rule.ps1#L324-L336
Try adding the missing sections and inherit them from base. I hope that helps.