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

|  Posted: January 11, 2021  |  Categories: BizTalk Server 2020

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 and  Transport URL’s
  • Import AS IS and on the Administration Console, manually change these parameters
  • 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.

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.

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

  • BizTalk Server 2020
  • BizTalk Server 2016

THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

Download

You can access and download the full PowerShell script from GitHub here: Update URI on BizTalk Server Send Ports with PowerShell

Author: Sandro Pereira

Sandro Pereira is an Azure MVP and works as an Integration 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.

Back to Top