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
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