Practical BizTalk
Friday, January 8, 2021
Automate BRE Xml File Import - PowerShell Code, Part 2
Friday, October 30, 2020
Automate BRE Xml File Import - PowerShell Code
There isn't a lot of information on how to automate a BRE xml file import. Many suggest using the PowerShell provider that used to be available on Codeplex, but unfortunately it's now a dead page. There are other resources (QuickLearn) that explain using assemblies in the BizTalk SDK folder. These have been available since BizTalk 2013. It appears that what was available in Codeplex has been lifted and shifted to the BizTalk installation process (to the SDK subfolder) on your local server.
This is all good, but there are some limitations. First, Microsoft doesn't offer any real documentation for the PowerShell SDK. I had to revert back to a different site to get documentation (version 1.4.0.1, published back in 2014 by Randal van Splunteren and Maxime Labelle) for the PowerShell Provider documentation.
Second, upon looking at this documentation, the BizTalk PowerShell provider doesn't allow for the creation (or importing) of certain artifacts. See screenshot below, highlighted area.
So I came across this on the Microsoft website which had a C# snippet of doing what I wanted. I decided to convert it to PowerShell, since the rest of my processes use PowerShell for builds, releases, and deployments. I now can now script this out to automate deployments of BRE xml files. In my case, I use Azure DevOps to perform this using a 'PowerShell on Target Machines' task.
So here's my version of that - use and modify at your own risk. Enjoy!
Tuesday, April 9, 2019
TFS Release Notes Write-Verbose continued
One of the issues we ran into was executing a command but we weren't getting the output. In my case we were trying to call BizTalk's btstask.exe command in a PowerShell script, which was saved to the local remote server. Every now and then we'd get an error, but it wasn't properly displaying in the TFS Release log. So we would need to manually run the command by remoting into the server and then look at the output to verify what the issue was (typically we didn't delete existing suspended messages, so we couldn't update the application).
Initially I thought capturing the output via a variable would work, like so:
$myBtsTaskOutput = BTSTask.exe AddResource /Source:$srcPath /ApplicationName:$appName /Type:$resType /Overwrite /Destination:"%BTAD_InstallDir%\$outputFile" $gacOptions
However, when I tried to capture the output by using:
Write-Verbose $myBtsTaskOutput -Verbosethe command would fail with an object error. Even using .ToString() failed.
The proper way to get the output is to immediately cast the type of the variable to a string, like so:
[string]$myBtsTaskOutput = BTSTask.exe AddResource...
Now the Write-Verbose command will give you the proper output. Super simple :)
Thursday, October 25, 2018
Notes on building a BizTalk Build and Release Server using TFS
Here are the background/requirements/setup:
- Visual Studio 2015 is being used to develop the BizTalk 2016 solutions
- We use two NuGet repositories: The main NuGet repository, and our own company-based repository. I'll discuss the NuGet setup in a later post.
- We are using the MSBuild. XAML is not being used.
- Deployment Framework for BizTalk 5.7 is being used.
- Use of some simple, custom PowerShell scripts on local server is secondary method when BTDF doesn't make sense.
- Right now I have just one agent set up. I really haven't come upon a need to add more. It's easy enough to add more agents, so there's no need to fret on this.
I did follow a good portion of what Vikas Bhardwaj put in his blog - it's a fantastic resource and got me going in the right direction. Please take the time to read all parts, as there is good information in each one.
- You will need to ensure you have opened ports HTTP, HTTPS, and Windows Remoting (80, 443, 5985, and 5986) between the build server and the destination servers when using the build server to do Releases/Deployments. The port for PowerShell is needed only if you are going to perform a 'PowerShell on Target Machines' task. This has been a huge plus, as I'll explain later.
- Since we are using BizTalk 2016, I installed Visual Studio 2015. Make sure you install all the necessary components (i.e. C#, VB.NET, whatever) you require in order to do a proper solution build. For me, I left the default values alone.
- Install BizTalk 2016, but select only the following:
- Just the Developer Tools and SDK
- Server Runtime (and all sub-categories) - you need this to compile a BizTalk solution.
- Administration Tools And Monitoring (and all sub-categories)
- Additional Software
- Enterprise Single Sign-On Administration
- Enterprise Single Sign-On Master Server
- BAM Client
- Project Build Component
- Allow the installation wizard to install the Prerequisites
- DO NOT CONFIGURE BIZTALK !!!!!
- Note on the above: my interpretation is that a BizTalk license isn't necessary. See BizTalk Pricing. Send me a note if that is incorrect.
- We installed the Deployment Framework for BizTalk, version 5.7. Select everything but the samples.
- We found that we came across two scenarios for building/deploying BizTalk artifacts:
- Large, complex applications worked very well under the BTDF
- Small projects (single map, receive location, etc) worked just fine running the btstask.exe command via a PowerShell on Local Server task. This is where opening port 5985 was critical. PowerShell remoting (WinRM) is VERY powerful.
- Installing an Agent wasn't difficult. However, having the proper rights/permissions was difficult. Make sure you have a good relationship with your server admins. ☺☺
Wednesday, December 20, 2017
Microsoft TFS Build and Release Notes - Write-Host errors in PS Script
There is, however, a good and bad way to log in a PowerShell script in VSTFS 2015/2017.
In your PowerShell tasks, do NOT use Write-Host, as this will fail when you try to run a Build or Release.
Instead, use Write-Verbose in the PS script and you will get the results you need.
Tuesday, October 3, 2017
BizTalk 2016 - WCF-Custom Transport: Unrecognized attribute 'ApplicationName'
I have a send port that uses the WCF-Custom/sqlBinding type as a send port on my local dev machine. Everything works as expected, so I exported the MSI and bindings to use on our Test environment.
When I imported the bindings file, I received an error: "Error loading properties. (System.Configuration.ConfigurationErrorsException) Unrecognized attribute 'ApplicationName'.
I compared the settings on my local dev to the Test environment and noticed some differences. This screenshot is from our Test environment
and this is from my local dev environment
Thursday, August 17, 2017
Cannot delete a send handler that is used by a send port
- Create a new Host and Host Instance with the desired name.
- Once that was done, add the Host to the appropriate adapter. For us it was adding it to the FILE adapter.
- Then re-configure all appropriate send ports to use the new Host Instance.
Restart Host Instances, and the send ports were properly using the newly created Hosts.
Once that was done, the thought was that the old host could be deleted. We came across a few things (some are obvious, others aren't so):
- In the BizTalk Admin Console, select Applications/All Artifacts
/Send Ports - Sort by Transport Type. Here is where you will see some that don't have the Transport Type as blank. These are your Dynamic Ports.
- For each Dynamic Port, open one up and, in the General tab, select 'Configure'.
- You will see a list of Send Handlers associated to each Adapter. You will need to make your changes in this list according to how you made your changes with your static Ports.
FYI - This was tested in BizTalk 2016. I don't believe you can navigate the same way in BizTalk 2010.