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 URIs 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 importing to the new environment, open Notepad or another editor and manually replace all occurrences of the Inbound Transport URL and Outbound Transport URL.
- Import AS IS, then manually change these parameters in the Administration Console.
- Or script this process.
This is not always a quick and easy job. Luckily for us, these tasks can be automated, making them simpler, faster, and less error-prone.
This script that I will be showing you can be very useful, for example, in scenarios where during the lifecycle of existing applications, one system is 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.
📝 One-Minute Brief
Shows how to update the URI (or part of it) on BizTalk Server Receive Locations using PowerShell, helping administrators quickly adjust endpoints during deployments, environment moves, or system migrations—without manual editing of binding files. [blog.sandr…ereira.com]
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.
You can download this PowerShell script from GitHub:
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.
Hi Sandro,
Hope you’re doing good .
In the above blog page, the github download link is navigating to the code “Update Receive location credentials” and not to “Update URI” as per context. Thanks
Fixed! Thanks for letting me know