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:
These tasks lead to BizTalk Server Administrators having 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.
With this PowerShell sample, we will be able to set or update the Authentication Credential 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)) { $bindingConfiguration = $SendPort.PrimaryTransport.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" if($SendPort.PrimaryTransport.TransportType.Name -eq "FILE") { $bindingConfiguration.CustomProps.InsertAfter($passwordElement, $bindingConfiguration.CustomProps.CopyMode) } else { $bindingConfiguration.CustomProps.InsertAfter($passwordElement, $bindingConfiguration.CustomProps.EnableTransaction) } } if($bindingConfiguration.CustomProps.UserName.vt -eq "8") { $bindingConfiguration.CustomProps.UserName.InnerText = "my_username" } $transportConfigData = $bindingConfiguration.InnerXml $SendPort.PrimaryTransport.TransportTypeData = $transportConfigData }
This script was tested in:
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can access and download the full PowerShell script from GitHub here: Set Authentication Credential on BizTalk Server Send Ports with PowerShell