How to update the URI (or part of it) on BizTalk Server Receive Locations with PowerShell

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 ...
            [string] $address = $recLocation.Address
            $address = $address.Replace("DEV-SERVER-NAME","PRO_SERVER-NAME")
            # Sample of additional custom changes
                $address = $address.Replace("DATABASE","DATABASE-WITH-PREFIX-A")
                $address = $address.Replace("DATABASE","DATABASE-WITH-PREFIX-B")
            $recLocation.Address = $address

This script was tested in BizTalk Server 2016.



Update URI on BizTalk Server Receive Locations with PowerShellUpdate URI on BizTalk Server Receive Locations with PowerShell

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

3 thoughts on “How to update the URI (or part of it) on BizTalk Server Receive Locations with PowerShell”

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

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to Top