Xml Validation in a Logic App!

I’ve done some work with Logic Apps recently and got hung up on using the XML Validation. I started with a great Azure quickstart titled 201-logic-app-veter-pipeline that creates the following elements in the Logic App designer.

Workflow generated by the template

This works swimmingly when the xml is valid, however, when the xml does not conform to the xsd specified in the attached integration account, it makes the whole process fail. This likely works as intended but I’d like to log this failure to an external system and control the message back to the user.

There are two keys to making this work correctly,

  1. Making sure the condition runs on “Failed, Succeeded” by pressing the ellipse on the condition box and selecting “Configure run after”
  2. Add the following action in the conditional: actions(‘XML_Validation’).status ‘is equal to’ ‘Succeeded’

It should look something like this after you are finished.

Workflow generated by the template

You’ll have full access to the output of the XML_Validation’s output on and could potentially log something like actions(‘XML_Validation’)[‘outputs’][‘errors’] or just the Body of the XML Validation block.

I hope you find this useful.