by Sandro Pereira | Sep 29, 2020 | BizTalk Community Blogs via Syndication
When you deploy a new BizTalk Server solution to a different environment, and if for some reason, you don’t use or cannot use CI/CD (Continuous integration and continuous delivery):
- Your environment is too small to justify using CI/CD;
- The client doesn’t provide access to Visual Studio Team Services (VSTS);
- Don’t like to use BTDF (Deployment Framework for BizTalk);
- Not using custom tools like BizTalk Bindings Exporter tool;
Then one of the most common tasks you need to do is to change all the URI from all the ports, Receive Ports and Send Ports, from the binding files.
Of course, you can do it in many different ways, for example:
- Before import to the new environment, open notepad or any other editor, and manually replace all the Inbound Transport URL and Outbound Transport URL;
- Import AS IS and on the Administration Console, manually change these parameters;
- Or script this process;
This is not always a quick and easy job. Luckily for us, these tasks can be automated, leading them to become simpler, faster, and avoid fewer errors.
This script that I will be showing you can be very useful, for example, in scenarios that during the lifecycle of existing applications, one system got updated or migrated to a different version or server (or both), and we need to update the URI or part of it on a range of the Receive Locations according to the new configuration/specification.
PowerShell script overview
With this PowerShell sample, we will be able to set or update the URI (address) or part of the URI on a list of BizTalk Server Receive Locations deployed in your BizTalk Server environment.
foreach($receivePort in $catalog.ReceivePorts)
{
# For each receive location in your environment
foreach($recLocation in $receivePort.ReceiveLocations)
{
# In this case ...
if($rcvLocations.Contains($recLocation.Name))
{
[string] $address = $recLocation.Address
$address = $address.Replace("DEV-SERVER-NAME","PRO_SERVER-NAME")
# Sample of additional custom changes
if($address.Contains("PREFIX"))
{
$address = $address.Replace("DATABASE","DATABASE-WITH-PREFIX-A")
}
else
{
$address = $address.Replace("DATABASE","DATABASE-WITH-PREFIX-B")
}
$recLocation.Address = $address
}
}
}
This script was tested in BizTalk Server 2016.
Download
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
Update URI on BizTalk Server Receive Locations with PowerShell
GitHub
The post How to update the URI (or part of it) on BizTalk Server Receive Locations with PowerShell appeared first on SANDRO PEREIRA BIZTALK BLOG.
by Sandro Pereira | Jun 30, 2020 | BizTalk Community Blogs via Syndication
In the past, I wrote several blog post about Configuring BizTalk Server Host and Host Instances according to some of the Best Practices:
The reason I end up creating a new version for BizTalk Server 2016 was that previous scripts only did 90% of the work, and they were intended to be used on “day zero” of your environment, i.e., after you finish installing your environment.
So, I update my previous script to add more functionalities, mainly:
- Configure the Default Send Handler as the Send Handler for each existing static and Dynamic Send Ports
- Configure Receive Handlers from all the existing Receive locations
With these missing functionalities added to the script, it will configure or reconfigure 100% of your environment. You can use it on “day zero” or in an already up and running environment. Of course, this was optimized to BizTalk Server 2016 (but it can be executed in all precious BizTalk Server previous versions).
Why a new version dedicated to BizTalk Server 2020?
There are two reasons why I decide to create this new script, specific only to BizTalk Server 2020:
- The previous scripts don’t run properly in BizTalk Server 2020;
- And BizTalk Server 2020 now has support to Group Managed Service Accounts;
The first reason is very simple. The previous scripts will not work giving you an invalid credential error even though you are putting the correct credentials has Gaurav Sood kindly reported to me.
The reason why this error is happening was because one undocumented change that product group made on the MSBTS_HostInstance WMI Class and now the method Install has a new mandatory parameter:
- IsGmsaAccount: a boolean that will define whether or not we will use Group Managed Service Accounts
Now the method parameters will be:
- System.Management.ManagementBaseObject Install(System.String Logon, System.String Password, System.Boolean GrantLogOnAsService, System.Boolean IsGmsaAccount)
- Logon: String containing the logon information used by the host instance;
- Password: String containing the password for the host.
- GrantLogOnAsService: Boolean determining whether the ‘Log On As Service’ privilege should be automatically granted to the specified logon user or not. This flag only has effect when the HostType property is set to In-process.
- IsGmsaAccount: a boolean that will define whether or not we will use Group Managed Service Accounts
- If true, the password can be empty;
The second reason is related to the first one. Now BizTalk Server 2020 has support Group Managed Service Accounts (gMSA) and since I’m changing this script I also want to add support to this feature.
What is Host and a Host Instances?
The BizTalk Host is a logical process and security boundary within BizTalk Server that represents a logical set of zero or more run-time processes in which you can deploy BizTalk Server services and artifacts (such as adapter handlers, receive locations, and orchestrations). Each host has a security group assigned to it and may contain multiple host instances, each on an individual machine, that perform the work of the host.
In another hand, a host instance is the physical instance of a host on a computer running BizTalk Server. Each host instance belongs to exactly one host, and the service account of the host instance belongs to the security group of the host. The security group may be used to grant permissions to physical resources such as databases for use by any host instances in the host.
What is an Adapter Handler?
An adapter handler is an instance of a BizTalk host in which the adapter code runs. When you specify a send or receive handler for an adapter you are specifying which host instance the adapter code will run in the context of. An adapter handler is responsible for executing the adapter and contains properties for a specific instance of an adapter.
The default BizTalk Server configuration will only create one in-process host, “BizTalkServerApplication”, that will be associated as a receive and send adapter handler for all of the installed adapters, with the exception of HTTP, SOAP, WCF-BasicHttp, WCF-WSHttp, and WCF-CustomIsolated adapter receive handlers that can only be running in an isolated host.
How can I automate this task?
Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them in automating tasks.
This is a simple script that will configure the following components in your environment:
- Create Host and Host Instance according to some of the best practices: two Receive host and host instances (one 32-bits and one 64-bits); two Send host and host instances (one 32-bits and one 64-bits); One Host and Host Instance to process Orchestrations and one Host and Host Instance for tracking;
- Create Receive and Send Handlers for each adapter;
- And finally, associate the correct Receive and Send Handlers to each existing receive and send ports present in your environment
Download
THIS POWERSHELL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
The script can be found and download on GitHub:
PowerShell to Configure BizTalk Server 2020 Host, Host Instances and Handlers
GitHub
The post BizTalk Server 2020: PowerShell to Configure Host, Host Instances and Adapter handlers according to some of the Best Practices appeared first on SANDRO PEREIRA BIZTALK BLOG.
by Sandro Pereira | Mar 11, 2020 | BizTalk Community Blogs via Syndication
You probably wonder why I haven’t written anything significant yet about this new version of the product. And I could come up with several real reasons but that is not the point here. However, to compensate for this “delay” I will start a crazy personal challenge, which I don’t know where I will find the time, to write 20 posts focus on BizTalk Server 2020 in the next 20 days: BizTalk Server 2020 – 20 days, 20 posts.
This series of posts could be about how to do certain things, what’s new in the product, step by steps guides, tools, components, tips and so on. And to start this series of posts I have chosen to migrate the BizTalk Port Multiplier Tool to be compatible with BizTalk Server 2020.
BizTalk Port Multiplier Tool
BizTalk Port Multiplier Tool is a simple tool that aims to simplify the port “cloning” process by allowing you to quickly “clone or duplicate” any existing port: Receive Port or Send Port.
- Send Ports are quite easy to archive, you only need to give a different name to the port, and you can clone it;
- Receive Ports are tricky because they may contain several Receive Locations and each URI needs to be unique;
This tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate port creation based on an existing one a little simple and easy allowing you to:
- Create a new Receive Port based on an existing one;
- It will also export the binding file from that new Receive Port;
- Create a new Send Port based on an existing one;
- It will also export the binding file from that new Send Port;
- Generate different binding files for each environment
Why do I need to “clone” a Receive Port?
Sometimes you also need to create a receive port with similar configurations of an existing one, also changing only a few settings or simple the URI, and instead of manually recreating, you can have 90% of the process done automatically.
Sometimes it is practical, occasionally, or in some scenarios, it may not work, but in most cases, it will. So it is a best-effort operation and not an exact clone because they may have several Receive Locations, and each Address/URI needs to be unique. So, you then need to go to each receive location and reconfigure them.
Other versions
This tool is also available for the following BizTalk Server versions:
Download
You can download BizTalk Port Multiplier Tool from:
BizTalk Port Multiplier Tool
GitHub
The post BizTalk Server 2020 – 20 days, 20 posts: BizTalk Port Multiplier Tool for BizTalk Server 2020 appeared first on SANDRO PEREIRA BIZTALK BLOG.
by Sandro Pereira | Dec 22, 2019 | BizTalk Community Blogs via Syndication
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 Port Multiplier 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 Port Multiplier Tool.
BizTalk Port Multiplier Tool
BizTalk Port Multiplier Tool is a simple tool that aims to simplify the port “cloning” process by allowing you to quickly “clone or duplicate” any existing port: Receive Port or Send Port.
- Send Ports are quite easy to archive, you only need to give a different name to the port, and you can clone it;
- Receive Ports are tricky because they may contain several Receive Locations and each URI needs to be unique;
This tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate port creation based on an existing one a little simple and easy allowing you to:
- Create a new Receive Port based on an existing one;
- It will also export the binding file from that new Receive Port;
- Create a new Send Port based on an existing one;
- It will also export the binding file from that new Send Port;
- Generate different binding files for each environment
Why do I need to “clone” a Receive Port?
Sometimes you also need to create a receive port with similar configurations of an existing one, also changing only a few settings or simple the URI, and instead of manually recreating, you can have 90% of the process done automatically.
Sometimes it is practical, occasionally, or in some scenarios, it may not work, but in most cases, it will. So it is a best-effort operation and not an exact clone because they may have several Receive Locations, and each Address/URI needs to be unique. So, you then need to go to each receive location and reconfigure them.
Credits
Credits also to my team member at DevScope, Pedro Almeida that collaborated in the development of this tool.
Download
You can download BizTalk Port Multiplier Tool from:
BizTalk Port Multiplier Tool
GitHub
The post BizTalk Port Multiplier Tool for BizTalk Server 2013 R2 appeared first on SANDRO PEREIRA BIZTALK BLOG.
by Sandro Pereira | Aug 21, 2019 | BizTalk Community Blogs via Syndication
You may all remember Richard Seroter BizTalk SendPort Duplicator tool and how he descrived that frequently during development, and even in production, we have a need to create new BizTalk ports that are virtually identical to an existing one where we just need to change some small configurations like:
- Address/URI;
- Send Port Filter criteria;
- Different pipelines or pipeline components configuration;
- And so on.
And by default, the only options we have are:
- Export the application binding files, manually clean the file and change the values; And then import the Binding file again;
- Or manually recreate the entire port again;
Both options are time-consuming and need a lot of manually work.
And Richard Seroter was, and still is, an amazing lifesaving tool that allows you to duplicate send ports easily, so why a new tool?
“BizTalk Port Multiplier Tool” it has all Richard tool functionalities but is more than a Send Port Duplicator, and that is the reason I decided to create a new tool.
“BizTalk Port Multiplier Tool” is a simple tool that aims to simplify port “cloning” process by allowing you to easily “clone or duplicate” any existing port: Receive Port or Send Port.
- Send Ports are easy, you only need to give a different name to the port, and you can clone it;

- Receive Ports are tricky because they may contain several Receive Locations and the URI needs to be unique;

This tool will extend default BizTalk Server capabilities transforming the tedious and sometimes complicate port creation based on an existing one a little simple and easy allowing you to:
- Create a new Receive Port based on an existing one;
- It will also export the binding file from that new Receive Port;
- Create a new Send Port based on an existing one;
- It will also export the binding file from that new Send Port;
- Generate different binding files for each environment
Why do I need to “clone” a Receive Port?
Sometimes you also need to create a receive port with similar configurations of an existing one, also changing only few configurations or simple the URI and instead of manually recreating you can have 90% of the process done automatically.
Sometimes is practical, sometimes or in some scenarios it may not work but in most of the cases it will. So it is basically a best-effort operation and not an exact clone because they may have several Receive Locations and the Address/URI needs to be unique. So, you then need to go to each receive location and reconfigure them.
Download
Credits also to my team member at DevScope, Pedro Almeida that collaborated in the development of this tool.
You can download BizTalk Port Multiplier Tool from:
BizTalk Port Multiplier Tool
GitHub
Or from:
BizTalk Port Multiplier Tool
Microsoft | Code Gallery
The post BizTalk Port Multiplier Tool appeared first on SANDRO PEREIRA BIZTALK BLOG.
by Sandro Pereira | May 27, 2019 | BizTalk Community Blogs via Syndication
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.