This is the second PowerShell sample in a series of samples that I will do on this topic addressing some of the real case scenarios that we may face daily:
Today’s blog post will be about: How to Export BizTalk Server Resource Bindings by Assembly FQ Name with PowerShell.
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, again, even in all 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.
Once again, 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.
Like the previous sample, we could fully automate this Binding generation for each environment, but once again, let’s keep it simple and address what is mandatory and easily forgotten. With this PowerShell sample for a specific assembly, with a fully qualified name, deployed in my BizTalk Server environment, I can easily:
function bts-resource-exportbindings-by-assembly-fqname([string]$bindingFilePath, [string]$appName, [string]$assemblyFQName, [boolean]$generateDiffEnvBindings) { $dllName = $assemblyFQName.Substring(0, $assemblyFQName.IndexOf(',')) $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$dllName.BindingInfo.xml /AssemblyName:""$assemblyFQName"" ” Start-Process "BTSTask.exe" $taskParams -Wait if($generateDiffEnvBindings) { $xml = (Get-Content "$bindingfilePath$appName.$dllName.BindingInfo.xml") # QA Binding Info Generation $xml.SelectNodes("//Host") | % { $_.NtGroupName = $global:qaNTGroupName } $xml.Save("$bindingfilePath$appName.$dllName.QA.BindingInfo.xml") # PRD Binding Info Generation $xml.SelectNodes("//Host") | % { $_.NtGroupName = $global:prdNTGroupName } $xml.Save("$bindingfilePath$appName.$dllName.PRD.BindingInfo.xml") } }
THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download the full script from here: Export BizTalk Server Resource Bindings by Assembly FQName with PowerShell