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):
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:
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.
The 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 Send Ports according to the new configuration/specification.
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 Send Ports deployed in your BizTalk Server environment.
foreach($SendPort in $catalog.SendPorts) { # In this case ... if($sndPorts.Contains($SendPort.Name)) { [string] $address = $SendPort.PrimaryTransport.Address if($address.Contains("mssql://")) { $address = $address.Replace("mssql://.","mssql://BTS2020LAB01") } else { $address = $address.Replace("C:\","D:\") } $SendPort.PrimaryTransport.Address = $address } }
This script was tested in:
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can access and download the full PowerShell script from GitHub here: Update URI on BizTalk Server Send Ports with PowerShell