I am working on Azure APIM bicep deployment and most of things are working . Now I am working on parameterizing the xml policy file. How can I parameterized using name values?
I tried following two example but its not working.
E.g. I set value in xml file {{ratelimit-value}} and created named value in apim with same name. So my xml policy looks like below
<policies>
<inbound>
<rate-limit calls="{{ratelimit-value}}" renewal-period="60" />
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
When I deploy it as it I am getting error in GitHub action as below
ERROR: ***"status":"Failed","error":***"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[***"code":"Conflict","message":"***\r\n \"status\": \"Failed\",\r\n \"error\": ***\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n ***\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n ***\r\n \"code\": \"BadRequest\",\r\n \"message\": \"***\\r\\n \\\"error\\\": ***\\r\\n \\\"code\\\": \\\"ValidationError\\\",\\r\\n \\\"message\\\": \\\"One or more fields contain incorrect values:\\\",\\r\\n \\\"details\\\": [\\r\\n ***\\r\\n \\\"code\\\": \\\"ValidationError\\\",\\r\\n \\\"target\\\": \\\"rate-limit\\\",\\r\\n \\\"message\\\": \\\"Error in element 'rate-limit' on line 3, column 10: Cannot find a property 'ratelimit-value'\\\"\\r\\n ***\\r\\n ]\\r\\n ***\\r\\n***\"\r\n ***\r\n ]\r\n ***\r\n ]\r\n ***\r\n***"***]***
policy reference in bicep file
// policy for all api resources
resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2021-08-01' = {
name: 'policy'
parent: api
properties: {
format: 'rawxml'
value: loadTextContent('./policies/all_operations_policy.xml')
}
}
How can I used named value created in APIm and reference in xml file dring bicep deployment