BizTalk Server 2020 – 20 days, 20 posts: BizTalk Bindings Exporter Tool for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts: BizTalk Bindings Exporter Tool for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts – day 3. Sorry for the delay but with this COVID-19 situation and with 3 small kids at home, sometimes it can be a challenge to find time to do community work and to write. Nevertheless, for today I have chosen to migrate another crucial and productivity tool that I really enjoy using it: BizTalk Bindings Exporter Tool to be compatible with BizTalk Server 2020. Once again, I hope you enjoy it as much as I do.

BizTalk Bindings Exporter Tool

BizTalk Binding Exporter Tool is a simple tool that will suppress the absence of advanced binding file generation capabilities in the BizTalk Server Administration Console allowing you to generate and export a binding file from BizTalk Applications in an intuitive and easy way.

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.

Normally the binding exportation starts in development, but we also will need to generate the same bindings for other environments like 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:

  • the URI’s: it should be fixed, but it is not mandatory. If you know what you are doing, you can fix them directly on the environment after you import the Binding.
  • the host instances: not mandatory, if you have the same host and host instances names across all your different environments (as best practices will tell you to do).
  • the NT Group Name associated in the Services (Orchestrations): according to securities best practices you shouldn’t use the same BizTalk Groups in different environments, so in this case, if you follow these best practices, you need to change these parameters in your binding file.

Normally, everyone changes the URI’s but neglecting the other parameters may be causing problems during the Binding import.

This tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate binding generation a little simple and easy.

DevScope BizTalk Bindings Exporter Tool

You just need to specify the connection string to the BizTalk Management database (BizTalkMgmtDb)

DevScope BizTalk Bindings Exporter Tool

And this tool allows you to generate and export binding files with the following capabilities:

  • Export binding(s) file(s) for an entire Application or a list of Applications;
  • Export binding(s) file(s) from a specify Assembly or list of Assemblies;
  • Export binding(s) file(s) from a Receive Port or list of Receive Ports;
  • Export binding(s) file(s) from a Send Port or list of Send Ports;
  • Or Generate different binding files for each environment if you create an Excel File with the mapping for each environment ;

Other versions

This tool is also available for the following BizTalk Server versions:

Download

You can download BizTalk Bindings Exporter Tool from:
BizTalk Bindings Exporter ToolBizTalk Bindings Exporter Tool
GitHub

The post BizTalk Server 2020 – 20 days, 20 posts: BizTalk Bindings Exporter Tool for BizTalk Server 2020 appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Bindings Exporter Tool for BizTalk Server 2013 R2

BizTalk Bindings Exporter Tool for BizTalk Server 2013 R2

Recently my team and I developed and released several tools that extend the out-of-box capabilities of BizTalk Server 2016 for developer and administration teams to be more productive, saving times in some simple but time-consuming tasks that should d supposed to be. One of these tools was BizTalk Bindings Exporter Tool.

Because many clients still are using BizTalk Server 2013 R2, and because I had received some requests from the community, I will be releasing these tools for BizTalk Server 2013 R2 also. And today, we will stat with the BizTalk Bindings Exporter Tool

BizTalk Bindings Exporter Tool

BizTalk Binding Exporter Tool is a simple tool that will suppress the absence of advanced binding file generation capabilities in the BizTalk Server Administration Console, allowing you to generate and export a binding file from BizTalk Applications in an intuitive and easy way.

Exporting a BizTalk Server Application binding is, at first sight, a quick and straightforward task that can be done using the BizTalk Server Administration Console:

  • Click Start, click All Programs, click Microsoft BizTalk Server 20xx, and then click BizTalk Server Administration
  • In the console tree, expand BizTalk Server Administration, expand the BizTalk Group, and then expand Applications
  • Right-click the application whose bindings you want to export, point to Export, and then click Bindings…
  • On the Export Bindings page, in Export to file, type the absolute path of the .xml file to which to export the bindings
  • Ensure that Export all bindings from the current application option is selected, and then click OK

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. Because out-of-the-box BizTalk Administration Console doesn’t allow you to:

  • Export a Binding file of a specif Receive Port or list of Receive Ports;
  • Export a Binding file of a specif Send Port or list of Send Ports;
  • Export a Binding file of a specif Assembly or list of Assemblies;

And these are just a few scenarios. You can only fully Export the binding files of an entire application, which will lead you to sometimes extensive and fallible manual work to clean the binding files.

Usually, the binding exportation starts in development. Still, we also need to generate the same bindings for other environments like production, and for that, we usually need to open the binding file and replace/fix the differences for each different environment… which usually is a tedious operation. What we need to replace is mainly:

  • the URI’s: it should be fixed, but it is not mandatory. If you know what you are doing, you can fix them directly on the environment after you import the Binding.
  • the host instances: not mandatory, if you have the same host and host instances names across all your different environments (as best practices will tell you to do).
  • the NT Group Name associated in the Services (Orchestrations): according to securities best practices you shouldn’t use the same BizTalk Groups in different environments, so in this case, if you follow these best practices, you need to change these parameters in your binding file.

Normally, everyone changes the URI’s but neglecting the other parameters may be causing problems during the Binding import.

Once again, this tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate binding generation a little simple and easy.

DevScope BizTalk Bindings Exporter Tool

You just need to specify the connection string to the BizTalk Management database (BizTalkMgmtDb)

DevScope BizTalk Bindings Exporter Tool

And this tool allows you to generate and export binding files with the following capabilities:

  • Export binding(s) file(s) for an entire Application or a list of Applications;
  • Export binding(s) file(s) from a specify Assembly or list of Assemblies;
  • Export binding(s) file(s) from a Receive Port or list of Receive Ports;
  • Export binding(s) file(s) from a Send Port or list of Send Ports;
  • Or Generate different binding files for each environment if you create an Excel File with the mapping for each environment ;

Credits also to my team member at DevScope, Pedro Almeida that collaborated in the development of this tool.

Download

You can download BizTalk Bindings Exporter Tool from:
BizTalk Bindings Exporter ToolBizTalk Bindings Exporter Tool
GitHub

The post BizTalk Bindings Exporter Tool for BizTalk Server 2013 R2 appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Bindings Exporter Tool

BizTalk Bindings Exporter Tool

Following my commitment with the attendees at Integrate 2019 London and US that shared with me the same headaches and concerns, and following my series of posts about “BizTalk Bindings Exportation” published on BizTalk360 blog. I’m happy to announce the birth of a new BizTalk Server tool: BizTalk Bindings Exporter Tool.

BizTalk Binding Exporter Tool” is a simple tool which will suppress the absence of advanced binding file generation capabilities in the BizTalk Server Administration Console allowing you to generate and export a binding file from BizTalk Applications in an intuitive and easy way.

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:

  • Click Start, click All Programs, click Microsoft BizTalk Server 20xx, and then click BizTalk Server Administration
  • In the console tree, expand BizTalk Server Administration, expand the BizTalk Group, and then expand Applications
  • Right-click the application whose bindings you want to export, point to Export, and then click Bindings…
  • On the Export Bindings page, in Export to file, type the absolute path of the .xml file to which to export the bindings
  • Ensure that Export all bindings from the current application option is selected, and then click OK

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. Because out-of-the-box BizTalk Administration Console doesn’t allow you to:

  • Export a Binding file of a specif Receive Port or list of Receive Ports;
  • Export a Binding file of a specif Send Port or list of Send Ports;
  • Export a Binding file of a specif Assembly or list of Assemblies;

And these are just a few scenarios. You can only fully Export the binding files of an entire application which will lead you sometimes an extensive and fallible manual work to clean the binding files.

Normally the binding exportation starts in development, but we also will need to generate the same bindings for other environments like 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:

  • the URI’s: it should be fixed, but it is not mandatory. If you know what you are doing, you can fix them directly on the environment after you import the Binding.
  • the host instances: not mandatory, if you have the same host and host instances names across all your different environments (as best practices will tell you to do).
  • the NT Group Name associated in the Services (Orchestrations): according to securities best practices you shouldn’t use the same BizTalk Groups in different environments, so in this case, if you follow this best practices, you need to change these parameters in your binding file.

Normally, everyone changes the URI’s but neglecting the other parameters may be causing problems during the Binding import.

Once again, this tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate binding generation a little simple and easy.

DevScope BizTalk Bindings Exporter Tool

You just need to specify the connection string to the BizTalk Management database (BizTalkMgmtDb)

DevScope BizTalk Bindings Exporter Tool

And this tool allows you to generate and export binding files with the following capabilities:

  • Export binding(s) file(s) for an entire Application or a list of Applications;
  • Export binding(s) file(s) from a specify Assembly or list of Assemblies;
  • Export binding(s) file(s) from a Receive Port or list of Receive Ports;
  • Export binding(s) file(s) from a Send Port or list of Send Ports;
  • Or Generate different binding files for each environment if you create an Excel File with the mapping for each environment ;

Credits also to my team member at DevScope, Pedro Almeida that collaborated in the development of this tool.

You can download BizTalk Bindings Exporter Tool from:
BizTalk Bindings Exporter ToolBizTalk Bindings Exporter Tool
GitHub

Or from:
BizTalk Bindings Exporter ToolBizTalk Bindings Exporter Tool
Microsoft | Code Gallery

The post BizTalk Bindings Exporter Tool appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Bindings Exportation: How to Export BizTalk Server Bindings by a List of Port Names with PowerShell

Finally, the last blog post on this series about BizTalk Bindings Exportation with PowerShell:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
    • Using the fully qualified name (FQName) of the assembly.
    • Using only the assembly name
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • How can we easily export a binding file from a list of assemblies?
    • By fully qualified name (FQName);
    • By assembly names;

Today’s blog post will be about: How to Export BizTalk Server Bindings by a List of Port Names with PowerShell.

In other words, instead of generating a specific binding file for each port: Receive Port and/or Send Port, we will include all of the receive ports and send ports bindings in a unique binding file, so it can easily be handled.

This functionality should be something that should exist in the BizTalk Server Administration Console, but it is impossible to be addressed using the out-of-the-box tool BizTalk Server Administration Console or even with the BTSTask command-line tool which is included with BizTalk Server.

As always, and like the previous samples, we could fully automate this Binding generation for each environment, but once again let’s keep it simple. With this PowerShell sample, we will be able to generate a unique binding file for a list of specific assemblies deployed in my BizTalk Server environment. The script will perform the following tasks:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Generate a unique binding file, instead of having separated binding files for each Port name (receive port and/or send port)
function bts-list-ports-exportbindings([string]$bindingFilePath, [string]$bindingNamePrefix, [string]$appName, [string]$rcvPortNames, [string]$sndPortNames, [boolean]$generateDiffEnvBindings)
{
    $finalBinding = (Get-Content "C:TempBTSTemplateBindingInfo.xml")
    $moduleRefNode = $finalBinding.SelectSingleNode("BindingInfo/ModuleRefCollection")
    $sendPortNode = $finalBinding.SelectSingleNode("BindingInfo/SendPortCollection")
    $receivePortNode = $finalBinding.SelectSingleNode("BindingInfo/ReceivePortCollection")

    $listRcvPorts = $rcvPortNames.Split("|")
    $listSndPorts = $sndPortNames.Split("|")

    $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.BindingInfo.xml /ApplicationName:$appName ”
    Start-Process "BTSTask.exe" $taskParams -Wait

    $xml = (Get-Content "$bindingfilePath$appName.BindingInfo.xml")

    foreach($receivePortBinding in $xml.BindingInfo.ReceivePortCollection.ReceivePort)
    {
        if($listRcvPorts -Contains $receivePortBinding.Name)
        {
            $node = $finalBinding.ImportNode(($receivePortBinding), $true);
            $receivePortNode.AppendChild($node);
        }
    }

    foreach($sendPortBinding in $xml.BindingInfo.SendPortCollection.SendPort)
    {
        if($listSndPorts -Contains $sendPortBinding.Name)
        {
            $node = $finalBinding.ImportNode(($sendPortBinding), $true);
            $sendPortNode.AppendChild($node);
        }
    }

    $finalBinding.Save("$bindingfilePath$bindingNamePrefix.BindingInfo.xml")

    if($generateDiffEnvBindings)
    {
        $finalBinding.Save("$bindingfilePath$bindingNamePrefix.QA.BindingInfo.xml")
        $finalBinding.Save("$bindingfilePath$bindingNamePrefix.PRD.BindingInfo.xml")
    }
}

THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

We will not change the URI for each environment – it could be done, but is not the goal here, it is just a start.

You can download the full script from here: Export BizTalk Server Bindings from a List of Port Names with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Bindings by a List of Port Names with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Send Port Binding with PowerShell

Let’s continue with some deep dive scripts about exporting BizTalk Server bindings, addressing some useful and unsupported scenarios that are impossible to be addressed using out-of-the-box with the standard tools BizTalk Server Administration Console or even with the BTSTask command-line tool included with BizTalk Server.

  • How can we easily export a binding file from a list of assemblies?
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

Also recapitulating some of the default scenarios/functionalities already addressed previously done in a different way and with small improvements with PowerShell:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
    • Using the fully qualified name (FQName) of the assembly.
    • Using only the assembly name

Today’s blog post will be about: How to Export BizTalk Server Send Port Binding with PowerShell.

Like Receive Ports, this functionality should be something that should exist in the BizTalk Server Administration Console, but it doesn’t. In some cases we can achieve this in the developing phase using the Visual Studio, while we generate the schemas for LOB systems, for example:

  • In the Solution Explorer, right-click a BizTalk project, point to Add, and then click Add Generated Items
  • In the Add Generated Items… – <BizTalk ProjectName> dialog box, in the Templates section, click Consume Adapter Service and then click Add
  • You should then select the binding you want to use, configure the parameters and the operations you want to do

Along with the LOB Schemas, this will also generate the binding files for the receive port or send port.

So, again, the question that we may ask is: Is there any way that we can easily accomplish this? The response is yes, again, all of this can be fully automated using, for example, PowerShell scripts.

This script, combined with the Receive Ports, is extremely useful if:

  • you use several cases of content-based routing (without orchestrations)
  • you create new send ports, for example with filters
  • new receive port in your environment

and if you don’t want to export/import the full application binding that may affect something that you already have in production.

Like the previous samples, 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 we will be able to generate a binding file for a specific assembly name deployed in my BizTalk Server environment. The script will perform the following tasks:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Changing the NT Group Name for each different environment
  • Generate a specific Send Port deployed in your environment
function bts-send-port-exportbindings([string]$bindingFilePath, [string]$appName, [string]$portName, [boolean]$generateDiffEnvBindings)
{
    $portRen = $portName.Replace(" ", "")
    $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$portRen.BindingInfo.xml /ApplicationName:$appName ”
    #First version: $p = [diagnostics.process]::start(“BTSTask.exe”, $taskParams)
    Start-Process "BTSTask.exe" $taskParams -Wait

    $xml = (Get-Content "$bindingfilePath$appName.$portRen.BindingInfo.xml")
    foreach($RemoveModuleRef in $xml.BindingInfo.ModuleRefCollection.ModuleRef)
    {
        $xml.BindingInfo.ModuleRefCollection.RemoveChild($RemoveModuleRef)
    }
    foreach($RemoveSendPort in $xml.BindingInfo.SendPortCollection.SendPort)
    {
        if($RemoveSendPort.Name -ne $portName)
        {
            $xml.BindingInfo.SendPortCollection.RemoveChild($RemoveSendPort)
        }
    }
    foreach($RemoveReceivePort in $xml.BindingInfo.ReceivePortCollection.ReceivePort)
    {
        $xml.BindingInfo.ReceivePortCollection.RemoveChild($RemoveReceivePort)
    }
    $xml.Save("$bindingfilePath$appName.$portRen.BindingInfo.xml")

    if($generateDiffEnvBindings)
    {
        # QA Binding Info Generation
        $xml.SelectNodes("//Host") | % { 
            $_.NtGroupName = $global:qaNTGroupName
        }
        $xml.Save("$bindingfilePath$appName.$portRen.QA.BindingInfo.xml")

        # PRD Binding Info Generation
        $xml.SelectNodes("//Host") | % { 
            $_.NtGroupName = $global:prdNTGroupName
        }
        $xml.Save("$bindingfilePath$appName.$portRen.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 Send Port Binding with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Send Port Binding with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Receive Port Binding with PowerShell

Until now we have seen some default functionalities, except for the last sample, done in a different way and with small improvements with PowerShell:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
    • Using the fully qualified name (FQName) of the assembly.
    • Using only the assembly name

From now on we will deep dive in this topic, addressing some useful unsupported scenarios, which are impossible to be addressed using the out-of-the-box tools BizTalk Server Administration Console or even with the BTSTask command-line tool included with BizTalk Server.

  • How can we easily export a binding file from a list of assemblies?
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

Today’s blog post will be about: How to Export BizTalk Server Receive Port Binding with PowerShell.

This functionality should be something that should exist in the BizTalk Server Administration Console; in some cases, we can achieve this in the developing phase using the Visual Studio while we generate the schemas for LOB system, for example:

  • In the Solution Explorer, right-click a BizTalk project, point to Add, and then click Add Generated Items.
  • In the Add Generated Items… – <BizTalk ProjectName> dialog box, in the Templates section, click Consume Adapter Service and then click Add
  • You should then select the binding you want to use, configure the parameters and the operations you want to do

Along with the LOB Schemas, this will also generate the binding files for the receive port or send port.

Why we don’t have this option in the BizTalk Server Administration Console for me is unclear, it should be there since day one in my opinion.

So, again, the question that we may ask is: Is there any way that we can easily accomplish this? The response is yes, again, all of this can be fully automated using, for example, PowerShell scripts.

Like the previous samples, 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, we will be able to generate a binding file for a specific assembly name which is deployed in my BizTalk Server environment. The script will perform the following tasks:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Changing the NT Group Name for each different environment
  • Generate a specific Receive Port deployed in your environment
function bts-receive-port-exportbindings([string]$bindingFilePath, [string]$appName, [string]$portName, [boolean]$generateDiffEnvBindings)
{
    $portRen = $portName.Replace(" ", "")

    $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$portRen.BindingInfo.xml /ApplicationName:$appName ”
    #First version: $p = [diagnostics.process]::start(“BTSTask.exe”, $taskParams)
    Start-Process "BTSTask.exe" $taskParams -Wait

    $xml = (Get-Content "$bindingfilePath$appName.$portRen.BindingInfo.xml")
    foreach($RemoveModuleRef in $xml.BindingInfo.ModuleRefCollection.ModuleRef)
    {
        $xml.BindingInfo.ModuleRefCollection.RemoveChild($RemoveModuleRef)
    }
    foreach($RemoveSendPort in $xml.BindingInfo.SendPortCollection.SendPort)
    {
        $xml.BindingInfo.SendPortCollection.RemoveChild($RemoveSendPort)
    }
    foreach($RemoveReceivePort in $xml.BindingInfo.ReceivePortCollection.ReceivePort)
    {
        if($RemoveReceivePort.Name -ne $portName)
        {
            $xml.BindingInfo.ReceivePortCollection.RemoveChild($RemoveReceivePort)
        }
    }
    $xml.Save("$bindingfilePath$appName.$portRen.BindingInfo.xml")

    if($generateDiffEnvBindings)
    {
        $xml.Save("$bindingfilePath$appName.$portRen.QA.BindingInfo.xml")
        $xml.Save("$bindingfilePath$appName.$portRen.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 Receive Port Binding with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Receive Port Binding with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings from a List of Assembly Names with PowerShell

On the last blog post and PowerShell sample we addressed, for the first time in the series of posts, a way to aggregate several binding exportations in a unique binding file based on a list of assemblies with fully qualified names (FQName):

  • How can we easily export a binding file from a list of assemblies?
    • By fully qualified name (FQName);

Today’s blog post will be similar, but instead of using the FQName, we will be using the assembly name only: How to Export BizTalk Server Resource Bindings from a List of Assembly Names with PowerShell

In other words, instead of generating a specific binding file for each resource: Receive Port, Send Port or Assembly, we will be generating a unique binding file that will include all of this information so it can easily be handled.

Recapping also the samples we have shared until now:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
    • Using the fully qualified name (FQName) of the assembly.
    • Using only the assembly name
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

And to unveil the last chapter of this series that we will be publishing soon:

  • How can we easily export a binding file from a list of Receive Ports and/or Send Ports?

Just like the previous samples, 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, we will be able to generate a unique binding file for a list of specific assemblies deployed in my BizTalk Server environment. The script will perform the following tasks:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Changing the NT Group Name for each different environment
  • Generate a unique binding file, instead of having separated binding files for each assembly
function bts-list-resource-exportbindings-by-assembly-name([string]$bindingFilePath, [string]$appName, [string]$listAssemblyName, [boolean]$generateDiffEnvBindings)
{
    #splits all the assemblies by |
    $list = $listAssemblyName.Split("|") 
    $finalBinding = (Get-Content "C:TempTemplateBindingInfo.xml")
    $moduleRefNode = $finalBinding.SelectSingleNode("BindingInfo/ModuleRefCollection")
    $sendPortNode = $finalBinding.SelectSingleNode("BindingInfo/SendPortCollection")
    $receivePortNode = $finalBinding.SelectSingleNode("BindingInfo/ReceivePortCollection")
    $displayName = 'assemblyName'
    $appsList=New-Object System.Collections.ArrayList
    $assemblyListFQN = New-Object System.Collections.ArrayList     
    $appsList = BTSTask.exe ListApp /ApplicationName:$appName
    #region Add FQN to list
    foreach($string in $appsList)
    {         
        #region Get Assembly Fully Qualified Name
        $list = $listAssemblyName.Split("|")
                    
        foreach($element in $list)
        { 
            if($string.Contains('-'))
            {
                if($string.Split('-')[1].Split('"')[1] -eq "System.BizTalk:BizTalkAssembly")
                {
                    foreach($element in $list){      
                        if($string.Split('-')[2].Split('"')[1].StartsWith($element))
                        {
                            if(!$assemblyListFQN.Contains($string.Split('-')[2].Split('"')[1])){
                                $assemblyListFQN.Add($string.Split('-')[2].Split('"')[1]);
                                #display name Set
                            }
                        }
                    }
                }
            }
        }
        #endregion   
    }
    #endregion
    
    #loop assemblies
    foreach($string in $assemblyListFQN)
    {        
        $dllName = $string.Substring(0, $string.IndexOf(','))
        $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$dllName.BindingInfo.xml /AssemblyName:""$string"" ”
        Start-Process "BTSTask.exe" $taskParams -Wait

        $xml = (Get-Content "$bindingfilePath$appName.$dllName.BindingInfo.xml")

        foreach($moduleRef in $xml.BindingInfo.ModuleRefCollection.ModuleRef)
        {
            $node = $finalBinding.ImportNode(($moduleRef), $true);
            $moduleRefNode.AppendChild($node);
        }
        foreach($sendPort in $xml.BindingInfo.SendPortCollection.SendPort)
        {
            $node = $finalBinding.ImportNode(($sendPort), $true);
            $sendPortNode.AppendChild($node);
        }
        foreach($receivePort in $xml.BindingInfo.ReceivePortCollection.ReceivePort)
        {
            $node = $finalBinding.ImportNode(($receivePort), $true);
            $receivePortNode.AppendChild($node);
        }
    }
    $finalBinding.Save("$bindingfilePath$appName.BindingInfo.xml")

    #generate different Environments Bindings
    if($generateDiffEnvBindings)
    {
        $xml = (Get-Content "$bindingfilePath$appName.BindingInfo.xml")
    
        # QA Binding Info Generation
        $xml.SelectNodes("//Host") | % { 
            if(!$_.Attributes['xsi:nil'].Value)
            {
                $_.NtGroupName = $global:qaNTGroupName
            }
        }
        $xml.Save("$bindingfilePath$appName.QA.BindingInfo.xml")

        # PRD Binding Info Generation
        $xml.SelectNodes("//Host") | % { 
            if(!$_.Attributes['xsi:nil'].Value)
            {
                $_.NtGroupName = $global:prdNTGroupName
            }
        }
        $xml.Save("$bindingfilePath$appName.PRD.BindingInfo.xml")
    }
}

THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

To be honest, I think this is the less useful script because it is not that much practical use, and also it will have several limitations when we have several and different versions of the same published DLL. But, it can be very useful and practical in situations where we can guarantee that we have only one DLL version published in our environment.

You can download the full script from here: Export BizTalk Resource Bindings from a List of Assembly Names with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings from a List of Assembly Names with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings from a List of Assemblies FQName with PowerShell

Until now, we have been addressing single operations, like generating binding files for one Receive or Send Port port or a single Assembly. Some of these default operations can be achieved with out-of-the-box tools (BizTalk Server Administration Console or even with BTSTask command-line tool included with BizTalk Server), other more advanced scenarios extend the default functionalities:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
    • Using the fully qualified name (FQName) of the assembly.
    • Using only the assembly name
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

From now on, we will be addressing some of the previous features described in this series of posts, but this time aggregating several operations for example:

  • How can we easily export a binding file from a list of assemblies?
    • By fully qualified name (FQName)
    • By assembly names
  • How can we easily export a binding file from a list of Receive Ports?
  • How can we easily export a binding file from a list of Send Ports?

In other words, instead of generating a specific binding file for each resource: Receive Port, Send Port or Assembly, we will be generating a unique binding file that will include all this information, so it can easily be handled.

Today’s blog post will be about: How to Export BizTalk Server Resource Bindings from a List of Assemblies FQName with PowerShell.

Out-of-the-box, we can export a binding file for a specific assembly which is deployed in your BizTalk Server environment. But if you have 10 assemblies then you will be forced to generate them one by one and you will end up with:

  • 10 different binding files that you can provide to your administration team
  • Or manually merge them into one and provide them to your administration team

This manual intervention, besides being monotonous, boring and time-consuming is subject to many failures. So the normal question is, is there any way that we can improve this experience? And the response is yes, all of this can be fully automated using, for example, PowerShell scripts.

Like the previous samples, 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 we will be able to generate a unique binding file for a list of specific assemblies deployed in my BizTalk Server environment. The script will take care of the following tasks:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Changing the NT Group Name for each different environment
  • Generate a unique binding file, instead of having separated binding files for each assembly
function bts-list-resource-exportbindings-by-assembly-fqname([string]$bindingFilePath, [string]$appName, [string]$listAssemblyFQName, [boolean]$generateDiffEnvBindings)
{
    $finalBinding = (Get-Content "C:TempBTSTemplateBindingInfo.xml")
    $moduleRefNode = $finalBinding.SelectSingleNode("BindingInfo/ModuleRefCollection")
    $sendPortNode = $finalBinding.SelectSingleNode("BindingInfo/SendPortCollection")
    $receivePortNode = $finalBinding.SelectSingleNode("BindingInfo/ReceivePortCollection")

    $list = $listAssemblyFQName.Split("|")

    foreach($element in $list)
    {
        $dllName = $element.Substring(0, $element.IndexOf(','))
        $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$dllName.BindingInfo.xml /AssemblyName:""$element"" ”
        Start-Process "BTSTask.exe" $taskParams -Wait

        $xml = (Get-Content "$bindingfilePath$appName.$dllName.BindingInfo.xml")

        foreach($moduleRef in $xml.BindingInfo.ModuleRefCollection.ModuleRef)
        {
            $node = $finalBinding.ImportNode(($moduleRef), $true);
            $moduleRefNode.AppendChild($node);
        }
        foreach($sendPort in $xml.BindingInfo.SendPortCollection.SendPort)
        {
            $node = $finalBinding.ImportNode(($sendPort), $true);
            $sendPortNode.AppendChild($node);
        }
        foreach($receivePort in $xml.BindingInfo.ReceivePortCollection.ReceivePort)
        {
            $node = $finalBinding.ImportNode(($receivePort), $true);
            $receivePortNode.AppendChild($node);
        }
    }

    $finalBinding.Save("$bindingfilePath$appName.BindingInfo.xml")

    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")
    }
}

THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the full script from here: Export BizTalk Resource Bindings from List of Assemblies FQName with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings from a List of Assemblies FQName with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly Name with PowerShell

Let’s go for the third PowerShell sample in a series of posts that, once again, I will be addressing some of the real case scenarios that we may face daily:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file for a specific assembly?
    • Using the fully qualified name (FQName) of the assembly
    • Using only the assembly name
  • How can we easily export a binding file from a list of assemblies?
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

Today’s blog post will be about: How to Export BizTalk Server Resource Bindings by Assembly Name (instead of the FQName) with PowerShell.

This is extremely similar to the previous one, but instead of using the fully qualified name (FQName) of the assembly, we will be using only the assembly name. Nevertheless, this small change will have a significant technical impact on the way we can archive this goal.

Just for getting started, and for you to be aware, this is impossible to do out-of-the-box with the standard tools:

  • BizTalk Server Administration Console
  • Or even with BTSTask command-line tool included with BizTalk Server. This tool provides the option for you to export binding information to a .xml file by using the ExportBindings command:
    • BTSTask ExportBindings /Destination: value [/GroupLevel] [/ApplicationName:value] [/AssemblyName:value ] | [/GlobalParties] [/Server:value] [/Database:value]
      • /ApplicationName: Name of the application from which to export bindings.
      • /AssemblyName: a Locally unique identifier (LUID) of the assembly from which to export bindings.

So, if you want to do something outside the box this is were the fun and challenges really start to appear and the question that we may ask is: Is there any way that we can accomplish this and at the same time improve the experience, similar to the previous examples? The response is that yes, all of this can be fully automated using, for example, PowerShell scripts.

Like the previous samples, 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, we will be able to generate a binding file for a specific assembly which is deployed in my BizTalk Server environment.

Generate a Binding file for 3 environments DEV, QA and PRD:

  • Changing the NT Group Name for each different environment
  • Generate a Binding file for each version of the assembly name found deployed
function bts-resource-exportbindings-by-assembly-name([string]$bindingFilePath, [string]$appName, [string]$assemblyName, [boolean]$generateDiffEnvBindings)
{
    $list= BTSTask.exe ListApp /ApplicationName:$appName 

    $list |foreach {
	    if ($_ -like '*Resource:*')
        {
            if($_.Split('-')[1].Split('"')[1] -eq "System.BizTalk:BizTalkAssembly")
            {
                $varAssemblyFQName = $_.Split('-')[2].Split('"')[1]
                $verison = $_.Split('-')[2].Split('"')[1].Split("=")[1].Split(",")[0]
                if($varAssemblyFQName -like "*"+ $assemblyName + "*")
                {
                    $taskParams = ” ExportBindings /Destination:$bindingfilePath$appName.$assemblyName.$verison.BindingInfo.xml /AssemblyName:""$varAssemblyFQName"" ”
                    Start-Process "BTSTask.exe" $taskParams -Wait

                    if($generateDiffEnvBindings)
                    {
                        $xml = (Get-Content "$bindingfilePath$appName.$assemblyName.$verison.BindingInfo.xml")
    
                        # QA Binding Info Generation
                        $xml.SelectNodes("//Host") | % { 
                            $_.NtGroupName = $global:qaNTGroupName
                        }
                        $xml.Save("$bindingfilePath$appName.$assemblyName.$verison.QA.BindingInfo.xml")

                        # PRD Binding Info Generation
                        $xml.SelectNodes("//Host") | % { 
                            $_.NtGroupName = $global:prdNTGroupName
                        }
                        $xml.Save("$bindingfilePath$appName.$assemblyName.$verison.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 Name with PowerShell

The post BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly Name with PowerShell appeared first on BizTalk360.

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly FQ Name with PowerShell

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly FQ Name with PowerShell

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:

  • How can we easily export a binding file from a BizTalk Application?
  • How can we easily export a binding file from a specify assembly?
  • How can we easily export a binding file from a list of assemblies?
  • How can we easily export a binding file from a Receive Port?
  • How can we easily export a binding file from a Send Port?
  • And many more

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:

  • Click Start, click All Programs, click Microsoft BizTalk Server 20xx, and then click BizTalk Server Administration
  • In the console tree, expand BizTalk Server Administration, expand the BizTalk Group, and then expand Applications
  • Right-click the application whose assembly is associated, and you want to export the bindings, or simply right-click on the Applications, point to Export, and then click Bindings…
  • On the Export Bindings page, in Export to file, type the absolute path of the .xml file to which to export the bindings
  • Ensure that Export bindings from the select assembly is selected, and then click OK

BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly FQName with PowerShell

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:

  • The URI’s – it should be fixed but it is not mandatory you can fix them directly on the environment after you import the Binding if you know what you are doing
  • The host instances – not mandatory if you have the same host and host instances names across all your different environments as best practices will tell you to do
  • The NT Group Name associated in the Services (Orchestrations) – according to security best practices you shouldn’t use the same BizTalk Groups in different environments, so in this case, if you follow this best practice, you need mandatory to change these parameters in your binding file

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 improve this experience? And the response is that yes, all of this can be fully automated by using, for example, PowerShell scripts.

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:

  • Generate a Binding file for 3 environments DEV, QA and PRD
  • Changing the NT Group Name for each different environment
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

The post BizTalk Bindings Exportation: How to Export BizTalk Server Resource Bindings by Assembly FQ Name with PowerShell appeared first on BizTalk360.