Video: How to create an Azure ARM template in Visual Studio 2015

2016-05-15_15-38-12I’m currently working on a Visual Studio ALM Rangers project to create an Azure ARM template that will deploy a secure SonarQube installation into Azure.  I found that there weren’t a lot of resources around how to get started with ARM templates in Visual Studio 2015.  In response I decided to create a walk-through.  I figured it would be easier for me to record a video of the process rather than try to write it out step-by-step.

The video is posted on Channel 9.

Let me know what you think of it in the comments here or there.

  • Steve

Updating the Microsoft TFS 2012 and Project Server 2013 VM to TFS 2013

I’ve recently had to perform an update to my copy of the Microsoft-provided Team Foundation Server 2012 and Project Server 2013 virtual machine

The virtual machine is running TFS 2012.1, SQL Server 2008 R2 Enterprise and Project Server 2013. Also, SQL Server Reporting Services was not needed for the demos performed on this VM, so it was never configured. Unfortunately, the upgrade can’t complete successfully if SSRS isn’t working. Given this configuration, there are a few prerequisites steps needed.


First off, login to the VM using the Administrator account (password: P2ssw0rd)

Configure SSRS

  • This is as easy as running the Reporting Services Configuration Manager program and starting the service.


  • Now go to the Web Service URL tab and click the Apply button to configure the web service.


  • We need to do the same thing on the Report Manager URL page. Click the Apply button here too.


  • We need to setup the database on the Database tab.  Click the Change Database button. In the Report Server Database Configuration Wizard, select Create a new report server database then click Next.


  • We are going to keep all of the defaults in this wizard, so just keep clicking Next, Next, Next. You will finally get configured, so click Finish to close the wizard.


  • The Database tab should now show the configured database and credentials.


Update SQL Server

TFS 2013 does not support SQL Server 2008 R2 so we need to upgrade the database in-place.  To do this, just grab your copy of SQL Server 2012 Enterprise with Service Pack 1 and run an Upgrade.

Note: Make sure you use the Enterprise version of SQL Server 2012 since the existing installation is Enterprise.

Upgrade TFS 2012.1 to TFS 2012.3

TFS 2012 Update 1 was a bit buggy, so I always recommend that folks go to the latest Quarterly Update before jumping major versions. This step will get the TFS databases upgrade and stable before we install TFS 2013.

As of this writing, TFS 2012 Update 3 is the latest releases version.  Just grab the Update and run it on your server. Nothing special here.

Note: You are going to need the ISO (1.1gb) for this step and the next, so download that file instead of the Web installer (743kb).

Update the Project Server Extensions  to TFS 2012.3

Install the Project Server Extensions for TFS 2012.3 from the ISO you downloaded for the last step.


Uninstall TFS 2012.3 Project Server Extensions

Yes, I know we just installed these, but that was to make sure the databases were all set.  With that done, we need to get these bits off the server so we can put down the 2013 bits.

Go to Add/Remove Programs and uninstall the Project Server Extensions.

Uninstall TFS 2012.3

Again, we need to clear out the old bits to make room for the new bits.  In Add/Remove Programs uninstall Microsoft Team Foundation Server 2012.

Install TFS 2013

Now we are ready to install TFS 2013.  This is a simple install.  When the installer is done, run the Upgrade Wizard to upgrade your databases.  Remember, the password is always P2ssw0rd.

Install the Project Server Extensions for TFS 2013

Just like in the 2012 case, these bits are on the TFS 2013 ISO disk in the Project Server Extensions folder.  Just run it and take the defaults.

That’s it!

You should now have a fully functional TFS 2013 with Project Server 2013 virtual machine to play with. Enjoy!

TFS 2012 – My warehouse jobs are supposed to be running but show QueuedScheduled


I just finished a very stressful couple of days.  I was working with a client to upgrade their TFS 2010 installation to TFS 2012.3.  During the process we had a couple of issues to resolve, but one of them was blog-worthy.

The stress came from the fact that if we couldn’t resolve these issues we would have to rollback the entire upgrade to TFS 2010. That would negate two weeks of work and probably have an very unhappy client.


After getting the customer’s system upgraded we noted that their warehouse wasn’t processing.  Strangely, when we launched the Warehouse Controller Web Service on the App Tier machine we saw that there were lots of jobs that had CurrentRun entries that showed a JobState of QueuedScheduled.

Notice that the Build Warehouse Sync job on Line 26 & 27 is showing a JobProcessingStatus of Idle, but the job’s CurrentRun element on lines 40&41 are showing that the job is running but in a QueuedScheduled JobState.  This makes entirely no sense.  The Job is running but it queued so it’s Idle?

 1: xml version="1.0" encoding="utf-8" ?>
 2: <WarehouseProcessingStatus 
 3:  xmlns:xsd=""
 4:  xmlns:xsi=""
 5:  xmlns="">
 6:  <RequestTimeUtc>2013-08-16T14:01:26.4000423ZRequestTimeUtc>
 7:  <WarehouseProcessingOnlineStatus>StartedWarehouseProcessingOnlineStatus>
 8:  <AnalysisProcessingOnlineStatus>StartedAnalysisProcessingOnlineStatus>
 9:  <JobProcessingStatus>IdleJobProcessingStatus>
 10:  <JobsRunning>0JobsRunning>
 11:  <JobsQueued>6JobsQueued>
 12:  <Instance Name="TEAM FOUNDATION"
 13:  JobProcessingStatus="Idle"
 14:  JobsRunning="0"
 15:  JobsQueued="1">
 16:  <Jobs>
 17:  ...
 18:  Jobs>
 19:  Instance>
 20:  <Collections>
 21:  <Collection Name="DefaultCollection"
 22:  JobProcessingStatus="Idle"
 23:  JobsRunning="0"
 24:  JobsQueued="5">
 25:  <Jobs>
 26:  <Job Name="Build Warehouse Sync" 
 27:  JobProcessingStatus="Idle">
 28:  <LastRun QueueTimeUtc="2013-08-16T01:52:33.423Z"
 29:  ExecutionStartTimeUtc="2013-08-16T02:15:11.017Z"
 30:  EndTimeUtc="2013-08-16T02:15:12.123Z"
 31:  Result="Blocked">
 32:  <ResultMessage>
 33:  [Build Warehouse Sync]: ---> TF221107: Reporting for
 34:  Team Foundation Server cannot execute job Build Warehouse Sync
 35:  for team project collection DefaultCollection because the 
 36:  warehouse is offline. Use the Team Foundation Administration 
 37:  Console to start reporting.
 38:  ResultMessage>
 39:  LastRun>
 40:  <CurrentRun QueueTimeUtc="2013-08-16T13:55:00.45Z" 
 41:  JobState="QueuedScheduled" />
 42:  Job>
 44:  ...
 46:  <Job Name="Work Item Tracking Warehouse Sync" 
 47:  JobProcessingStatus="Idle">
 48:  <LastRun QueueTimeUtc="2013-08-16T01:52:33.423Z" 
 49:  ExecutionStartTimeUtc="2013-08-16T02:15:11.017Z" 
 50:  EndTimeUtc="2013-08-16T02:15:12.123Z" 
 51:  Result="Blocked">
 52:  <ResultMessage>
 53:  [Work Item Tracking Warehouse Sync]: ---> TF221107: Reporting 
 54:  for Team Foundation Server cannot execute job
 55:  Work Item Tracking Warehouse Sync for team project collection
 56:  DefaultCollection because the warehouse is offline. Use the
 57:  Team Foundation Administration Console to start reporting.
 58:  ResultMessage>
 59:  LastRun>
 60:  <CurrentRun QueueTimeUtc="2013-08-16T13:55:00.45Z" 
 61:  JobState="QueuedScheduled" />
 62:  Job>
 63:  Jobs>
 64:  Collection>
 65:  Collections>
 66: WarehouseProcessingStatus>

Digging a little deeper, we jumped down to the Event Viewer on the App Tier machine. 

In case you are not aware, TFS has it’s own section to collect debugging records. These can be found in the Event Viewer | Applications and Services Logs | Microsoft Team Foundation Server | Debug.


One of the Information Debug Logs was showing the following error:


 1: Log Name: Microsoft-Team Foundation Server/Debug
 2: Source: Microsoft-Team Foundation Server
 3: Date: 8/16/2013 10:09:10 AM
 4: Event ID: 0
 5: Task Category: This task has debugging events
 6: Level: Error
 7: Keywords: Info Messages
 9: Computer:
 10: Description:
 11: TFS Informational message
 12: Event Xml:
 13: <Event xmlns="">
 14:  <System>
 15:  <Provider Name="Microsoft-Team Foundation Server" 
 16:  Guid="{81761665-68A4-47D5-8106-F2ED2AA8687B}" />
 17:  <EventID>0EventID>
 18:  <Version>0Version>
 19:  <Level>2Level>
 20:  <Task>1Task>
 21:  <Opcode>10Opcode>
 22:  <Keywords>0x8000000000000001Keywords>
 23:  <TimeCreated SystemTime="2013-08-16T14:09:10.375773800Z" />
 24:  <EventRecordID>13163EventRecordID>
 25:  <Correlation ActivityID="{018C9C58-F800-0003-99AD-5341209ACE01}" />
 26:  <Execution ProcessID="1472" ThreadID="4720" />
 27:  <Channel>Microsoft-Team Foundation Server/DebugChannel>
 28:  <Computer>>
 29:  <Security UserID="S-1-5-21-827956790-191126496-1124750213-8536" />
 30:  System>
 31:  <UserData>
 32:  <Info TraceId="{00000001-0001-0001-0000-000000000000} " 
 33:  xmlns="">
 34:  <Tracepoint>1600Tracepoint>
 35:  <ServiceHost>{00000000-0000-0000-0000-000000000000}ServiceHost>
 36:  <ContextId>0ContextId>
 37:  <ProcessName>TFSJobAgentProcessName>
 38:  <Username>
 39:  Username>
 40:  <Service>
 41:  Service>
 42:  <Method>
 43:  Method>
 44:  <Area>JobAgentArea>
 45:  <Layer>JobServiceUtilLayer>
 46:  <UserAgent>
 47:  UserAgent>
 48:  <Uri>
 49:  Uri>
 50:  <Path>
 51:  Path>
 52:  <UserDefined>
 53:  UserDefined>
 54:  <Message>
 55:  Attempt #155: System.ArgumentException: An item with the same key 
 56:  has already been added.
 57:  at System.Collections.Generic.Dictionary`2.Insert(TKey key, 
 58:  TValue value, 
 59:  Boolean add)
 60:  at Microsoft.TeamFoundation.Framework.Server
 61:  .TeamFoundationExtensionUtility.LoadExtensionTypeMap[T]
 62:  (String pluginDirectory)
 63:  at Microsoft.TeamFoundation.Framework.Server.JobApplication
 64:  .SetupInternal()
 65:  at Microsoft.TeamFoundation.Framework.Server.JobServiceUtil
 66:  .RetryOperationsUntilSuccessful(RetryOperations operations, 
 67:  Int32 maxTries, 
 68:  Int32& delayOnExceptionSeconds)
 69:  Message>
 70:  Info>
 71:  UserData>
 72: Event>

Notice on lines 37 & 55 – 56 we have the really important info.  The error is thrown by the TFSJobAgent and the problem is that it is trying to load an item with the same key into a Dictionary.


A quick online search turned up a blog post by Rory Street aptly entitled “TFSJobAgent Error – An item with the same key has already been added” in which he comments that the cause was that he had multiple copies of a custom warehouse adapter in the TFSJobAgent’s PlugIns folder. 

C:Program FilesMicrosoft Team Foundation Server 11.0Application TierTFSJobAgentplugins

When the TFSJobAgent service starts it recursively scans the Plugins folder looking for warehouse adapters (Microsoft’s or custom).  It uses reflection to find all of the assemblies that implement the ITeamFoundationJobExtension interface.  Since I have two copies of the same adapter (with different file names) in the folder, it tries to load them both and the names collide.  Rory had a slightly different configuration. He had copies of his custom warehouse adapter in a subfolder of PlugIns but the effect is the same sine the search is recursive

To clean up the multiple copies of my custom adapter in the PlugIns folder I needed to:

  • Start an elevated command prompt
  • Run: net stop TfsJobAgent
  • Delete the extra custom warehouse adapter DLLs from the Plugins folder (and its children)
  • Run: net start TFSJobAgent

Once that was done I rechecked the Warehouse Controller Web Service and all of my QueuedScheduled jobs were either Running or completed successfully.

Thanks Rory! 🙂

How To: Reset a Microsoft Surface RT back to Windows 8.0 after installing Windows 8.1 Preview

This post is an elaboration on the Microsoft Support Article Remove Windows 8.1 Preview from Surface.  I felt that this post was needed because of some confusing, missing and incorrect entries in the Microsoft article.

Like many folks, I decided to update my Surface RT to Windows 8.1 Preview the day it came out. The Surface is a new animal, so I wanted the ability to roll back to Windows 8.0 if it became necessary. To be honest, I generally run all Beta and RC versions of Microsoft Operating Systems on my day-to-day devices (laptop, tablet and Windows Phone) and put up with the hiccups so I didn’t expect to need to rollback.   

The Preview documentation says that you can RECOVER your device (wipe it back to 8.0 losing all data) if you create a Recovery USB Drive. I followed these direction to create my USB drive. 

Really, Really Important Stuff

NOTE: If you don’t have a Recovery USB drive prior to upgrading to Windows 8.1 Preview, you cannot reset back to Windows 8.0.  The Surface on-device recovery partition gets updated to Windows 8.1 Preview along with the main partition. Only the USB drive lets you go back.

NOTE 2: If you didn’t create a Recovery USB drive for your Surface you may still be able to get one after the fact.  You will need to create a Recovery drive on a friend, family member or co-worker’s device. Since the Recovery is a “wipe and reset” then any recovery drive should work.  Disclaimer: I haven’t had to do this, but I believe that it will work. Please take this into account if you decide to go this route.  The worst case scenario is that you brick your Surface. You have been warned.

NOTE 3: If you have upgraded your Surface RT device to Windows 8.1 Preview, you will be able to roll-forward to Windows 8.1 Release Candidate or full release when it becomes available. This action will preserve all of your settings and apps, it is non-destructive.

Why I Rolled-back

I had problems with some of the apps that I use regularly so I decided to wipe my device back to Windows 8.0.

Some of my problems included:

  • Scrolling in Rowi’s tweet list stuttered
  • I had 6 Windows Store Updates that would fail to install. when I marked them to be skipped they reappeared as updates when I rebooted.
  • The Kindle app would no longer keep track of the farthest page read , but would return to page 1 when opening a book.
  • The Mail app would randomly stop connecting to my Office365 email account after adding the account to Outlook RT.

With that said, I will probably reinstall the 8.1 Preview once I hear that the scrolling issues are fixed. I can deal with the rest or work around them fairly easily.

What I Did

I performed searches all over Google, Bing and the Microsoft Support Forums looking for the steps to reset my Surface. I was unsuccessful until this evening when I came across a Microsoft Support Article (linked at top).

As I was going through the steps I noticed some discrepancies, so I figured I’d document my steps in case anyone else comes across this.  I’m copying in the steps from the Microsoft article and adding my own comments as sub-bullet points.

Reset Surface from a USB recovery drive

  1. Open the Settings charm, tap or click Power, and then tap or click Shut down. (Or, tap or click the Power icon in the lower-right corner of the sign-in screen.)
  2. Attach the USB recovery drive to Surface.
  3. Hold the volume-down (-) rocker.
  4. Press and release the power button.
  5. When the Surface logo appears, release the volume rocker.
  6. Choose your language options.
  7. Choose your keyboard layout.
  8. From the BitLocker screen, tap or click Skip This Drive.
    • The keyboard might appear so tap the non-text area of the screen to dismiss it so you can see the Skip This Drive link.
  9. Tap or click Troubleshoot.
  10. Tap or click Reset your PC.
  11. Tap or click Next.
    • This is actually a button that says “Windows 8.1 Preview”. This kinda threw me. Select this button, it will give you Windows 8.0. You will have to wait a bit for the next screen to appear.
  12. Surface Pro only: Tap or click No, keep the existing partitions.
    • I saw this on my Surface RT. I selected “No” like this says.
  13. Tap or click Just remove my files.
  14. When Surface displays All ready to go, tap or click Reset.
    • This message never displayed. After Step 13, it went ahead and started the restore.

Surface will reset back to factory settings.


If this is helpful, if I’ve messed any steps up or if you see something different, please leave a comment below.


Using the Nugetter CodePlex project with TFS 2012 build throws TF215097 error


While working with a client recently I came across an issue that I think needs to be better documented.

We were implementing Nuget packaging in their TFS 2012 build process.  I knew from past engagements that the Nugetter project on CodePlex is an excellent way to easily add this activity to an existing build process.

We created the build definition using the NuGetterMultiPkgBuildVersionedTemplate20.xaml build process template. When we ran the build, it failed with the following error

TF215097: An error occurred while initializing a build for build definition
[Build Definition] nuget:
Exception Message: The invocation of the constructor on type
‘TfsBuild.NuGetter.Activities.NuGetterProcess’ that matches the specified
binding constraints threw an exception. (type XamlObjectWriterException)

Exception Stack Trace:
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType,
Object[] args)
at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(
ObjectWriterContext ctx)
at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter,
Boolean closeWriter)
at System.Activities.XamlIntegration.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(
Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings,
IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity,
ChildActivity& nextActivity, Stack`1& activitiesRemaining,
ActivityCallStack parentChain, IList`1& validationErrors,
ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(
ChildActivity currentActivity, ActivityCallStack parentChain,
ProcessActivityTreeOptions options, ProcessActivityCallback callback,
IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity,
LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options,
ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Validation.ActivityValidationServices
at Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.ValidateWorkflow(
Activity activity, ValidationSettings validationSettings)
at Microsoft.TeamFoundation.Build.Hosting.BuildProcessCache.LoadFromXaml(
String workflowXaml, TextExpressionImports textExpressionImports)
at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager
.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build,
WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(
WorkflowRequest request, WorkflowManagerActivity activity,
BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken)

Inner Exception Details:

Exception Message: Exception has been thrown by the target of an invocation.
(type TargetInvocationException)

Exception Stack Trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)
at System.Activities.XamlIntegration.ActivityXamlServices.GetXamlSchemaContext(
Assembly assembly, String helperClassName)
at System.Activities.XamlIntegration.ActivityXamlServices.InitializeComponent(
Type componentType, Object componentInstance)
at TfsBuild.NuGetter.Activities.NuGetterProcess.BeforeInitializeComponent(
Boolean& isInitialized)
at TfsBuild.NuGetter.Activities.NuGetterProcess.InitializeComponent()

Inner Exception Details:

Exception Message: Could not load file or assembly ‘System.Management.Automation,
PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.
The system cannot find the file specified. (type FileNotFoundException)

Exception Stack Trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,
String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint,
StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound,
Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,
Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark,
IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection,
Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at XamlStaticHelperNamespace._XamlStaticHelper.Load(String assemblyNameVal)
at XamlStaticHelperNamespace._XamlStaticHelper.LoadAssemblies()
at XamlStaticHelperNamespace._XamlStaticHelper.get_SchemaContext()

I’ve pasted the entire error message here so that it will be indexed by search engines and thus easier to find. 🙂


We did a little bit of searching online and followed a few dead-end trails.  We finally tracked down a discussion article on the Nugetter project’s discussion page that pointed to a mismatched PowerShell version on the build controller.

While our build controller machine was running Windows Server 2008 R2, we found that it only had PowerShell v1.0 installed.  We need to have PowerShell v3 installed for this to work.

We installed PowerShell v3 on the build controller and build agent and rebooted both machines.  When we triggered the build again it ran to completion.

I’m not sure if the updated PowerShell was necessary for the Build Agent machine but the client decided to install it anyway.


If you encounter this error, make sure the Build Controller box has PowerShell v3 installed on it.