How to update Authentication Credentials on BizTalk Server Receive Locations with PowerShell

With security be every day more important, this also brings additional problems (good problems) to BizTalk Server Administrators during the deployment of new BizTalk Server Applications or even during the lifecycle of existing applications:

  • What a few years ago was anonymous, because they were internal services, they are now authenticated.
  • Nowadays, many organizations implement a combination of Minimum Password Age policy also enforcing a Password History policy that requires to reset the password, even for services accounts, from time to time and avoid reusing the same password.

These tasks lead to BizTalk Server Administrators to manually set the user credentials in a range of ports (send and receive). 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.

PowerShell script overview

With this PowerShell sample, we will be able to set or update the Authentication Credential 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))
        {
            $bindingConfiguration = $recLocation.TransportTypeData
            if($bindingConfiguration.CustomProps.Password.vt -eq "1")
            {
                $bindingConfiguration.CustomProps.Password.InnerText = "my_password"
                $bindingConfiguration.CustomProps.Password.vt = "8"
            }
            else
            {
                $passwordElement = $bindingConfiguration.CreateElement("Password")
                $passwordElement.SetAttribute("vt", "8")
                $passwordElement.InnerText = "my_password"
                $bindingConfiguration.CustomProps.InsertAfter($passwordElement, $bindingConfiguration.CustomProps.SuspendMessageOnFailure)
            }
            if($bindingConfiguration.CustomProps.UserName.vt -eq "8")
            {
                $bindingConfiguration.CustomProps.UserName.InnerText = "my_username"
            }

            $transportConfigData = $bindingConfiguration.InnerXml
            $recLocation.TransportTypeData = $transportConfigData
        }
    }
}

This script was tested in BizTalk Server 2016.

Download

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

Set Authentication Credential on BizTalk Server Receive Locations with PowerShellSet Authentication Credential on BizTalk Server Receive Locations with PowerShell
GitHub

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.

1 thought on “How to update Authentication Credentials on BizTalk Server Receive Locations with PowerShell”

Leave a Reply

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

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top