This will be the first blog post in a series of articles that I will do on this topic addressing some of the real case scenarios that we may face daily:
The today blog post will be about: How can we easily export a binding file from a BizTalk Application?
Exporting a BizTalk Server Application binding is, at first sight, a simple and quick task that can be done using the BizTalk Server Administration Console:
But even in simple tasks, we may encounter challenges that require us to perform some monotonous and boring manual operations that consume some of our precious time and are always subject to failures.
The steps that I described above only generate the binding files from that specific environment, maybe or normally this all start in development, but we also will need to generate the same bindings for production and for that we normally need to open the binding file and replace/fix the differences for each different environment… which is normally a tedious operation. What we need to replace is mainly:
Normally, everyone changes the URI’s but neglecting the other parameters may be causing problems during the Binding import.
So, the question is: Is there any way that we can do to improve this experience? And the response is that yes, all of this can be fully automated by using, for example, PowerShell scripts.
Again, I could fully automate this Binding generation for each environment, but let’s keep it simple and address what is mandatory and easily forgotten. In this sample let’s see how I can easily:
function bts-application-exportbindings([string]$bindingFilePath, [string]$appName, [boolean]$generateDiffEnvBindings) { $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.BindingInfo.xml /ApplicationName:$appName ” #First version: $p = [diagnostics.process]::start(“BTSTask.exe”, $taskParams) Start-Process "BTSTask.exe" $taskParams -Wait if($generateDiffEnvBindings) { $xml = (Get-Content "$bindingfilePath$appName.BindingInfo.xml") # QA Binding Info Generation $xml.SelectNodes("//Host") | % { $_.NtGroupName = $global:qaNTGroupName } $xml.Save("$bindingfilePath$appName.QA.BindingInfo.xml") # PRD Binding Info Generation $xml.SelectNodes("//Host") | % { $_.NtGroupName = $global:prdNTGroupName } $xml.Save("$bindingfilePath$appName.PRD.BindingInfo.xml") } } bts-application-exportbindings 'C:\temp\BTS\' 'BizTalk Application 1' $True
THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download the full script from here: Export BizTalk Server Application Bindings with PowerShell