Azure / Azure/api-management-policy-snippets
PolicyFragment ARM Template deployment fails - The policy fragment is not a valid XML:
- Dominant language
- No language data
- Stars
- 399
- Forks
- 170
- PR merge metrics
- No merged PRs in 30d
Description
**Bicep Code**
```
param APIMName string
resource policyFragment2 'Microsoft.ApiManagement/service/policyFragments@2021-12-01-preview' = {
name: '${APIMName}/SetBasicAuthHeader'
properties: {
description: 'Sample desc'
format: 'xml'
value: './SetBasicAuthHeader.xml'
}
}
```
**Fragment**
Simplified to bare minimum
```
```
**CLI command to deploy**
` az deployment group create --resource-group APIM --template-file singlepolicyfragmentdeploy.bicep --parameters APIMName=karlrissapim`
**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":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"ValidationError\",\r\n \"message\": \"The policy fragment is not a valid XML: Data at the root level is invalid. Line 1, position 1.\",\r\n \"details\": null\r\n }\r\n}"}]}}`
**Additional Information**
We tried deploying from an Azure Storage account in case it needed a URI to reference the policy fragment, failed with the same error message.
We manually created a policy fragment in the portal, then saved the configuration to the repository and cloned the repository locally to inspect the policy fragment to see if there was a documentation bug and the fragment structure was different, the repository does not contain policy fragments so we were unable to view.
We also tried both format types, XML and RawXML.
Lastly, we also compiled bicep to arm and tried again, receiving the same error message.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.