I have been recently tasked with a project that requires ADFS and Azure. I quickly discovered as I started building out my production, staging, and development environments that I needed to use web.config transforms to handle my different environments. In the past, I would just create separate copies of the web.config, but that is not supported with Azure.

I was able to set up the transforms for the appSettings and connectionStrings, but soon got stuck on the Identity Model piece. I couldn’t seem to find much help by searching. I eventually figure it out, and here is the magic combination!


You’ll need to remove all existing audienceUris with attribute xdt:Transform=”RemoveAll”. Then insert the new item with the xdt:Transform=”Insert” attribute.




On the wsFederation portion, just call the xdt:Transform=”Replace” to replace.




Pretty simple. You can use this website to test your transformations to confirm they are correct: http://webconfigtransformationtester.apphb.com/