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

The post How to update Authentication Credentials on BizTalk Server Receive Locations with PowerShell appeared first on SANDRO PEREIRA BIZTALK BLOG.