Tuesday, 21 March 2017

Move TFS databases with no downtime, thanks to SQL Server AlwaysOn

If you follow this blog or my Twitter feed you should know I am a massive fan of SQL Server AlwaysOn.

Recently I restored and moved some TFS databases around, and one of them remained on a temporary storage because of the massive size involved. After a while I managed to sort out the primary storage so I could move this database (and its Transaction Log) back to it.

This what I did, no warranties of course but it worked on my machines!

First of all, you need to be aware that you will have a limited availability during this period. It doesn't mean you are going to have an outage, but that you cannot rely on the Secondary Replica while you work on it. Why? Because you need to disable the Automatic Failover and make any Secondary non-readable:

Then suspend Data Movement from the Primary. This means your Primary Replica is not going to sync with the Secondary.

You will get your database to move in a non synchronised state.

Now note down your logical names for the files you need to move. Use these in the following query, the path in the FILENAME is going to be the new destination:

Run this on all servers. You might want to wait for the Secondary to be up-and-running, but don't forget to run it against the Primary too!

Copy all the files to the new destination, once done restart SQL Server on the Secondary:

Now check that if Secondary is in a green state.

If the Secondary is green, resume Data Movement and after the status is Synchronised again perform a manual Failover so that the roles are swapped. Then perform all of the above on the new Secondary and you will be done.

Eventually, don't forget to re-enable any configuration you disabled before performing this!

Friday, 17 March 2017

Settle your team's disputes with an EditorConfig file

Ok, this is a bit too much :) but it is actually possible to settle some disputes on Visual Studio settings by leveraging on an EditorConfig file.

EditorConfig is a broadly adopted open-source file format that enables IDEs to be set in a pre-defined way so that you can have a consistent set of rules across tools. This is an ideal tool for creating a standard set of settings and guidelines to be adopted across the team, and Visual Studio 2017 now supports this format!

Kasey Uhlenhuth wrote a brilliant description of what is supported in the IDE, and the setting area is very well done with an actual example of what you are setting up.

Then you can configure how to enforce your style rules - bear in mind that errors are treated as such, so they would prevent a successful build!

If found in a solution, the .editorconfig file will override the default settings of the IDE – so to have a team-shared convention all you need to do is put the file into the root of the project folder, job done!

Wednesday, 8 March 2017

The new connected marketplace experience: how to buy Package Management for TFS

It is not news that in a Hybrid DevOps stack you might have stuff on-premise and stuff in the cloud, Package Management is a prime example of this.

If you don’t have a Visual Studio Enterprise license for any user in your organisation you’d need to buy some users’ licenses for this service. It is billed through Azure even if you are on-premise and totally disconnected from the internet.

You install it on-premise, but you would still set your billing to an Azure subscription when buying it:

Once you are done you can install the extension. Remember: if you have an Enterprise license (either with or without MSDN) you are already entitled to Package Management so you can install the extension straight away.

Also, if you need to manage your users you can browse to the Users hub (<your TFS>/<your collection>/_admin/_userHub) and assign licenses to whoever requires them:

This is exactly like VSTS, but on your on-premise TFS.

Sunday, 26 February 2017

Handle your NuGet packages’ qualities with Release Views

Are you building NuGet packages for your tools, utilities and libraries? Check.

Are you using SemVer for versioning? Check.

Then you might want an easy way of offering your (internal) packages, sorting them between Release and Prerelease for example. Release Views is what you are looking for.

What is really brilliant is that you already have a baseline set: Release and Prerelease. You don’t have to configure anything, it is already there for you.

What makes lots of sense IMHO is to divide them into Release, Prerelease and CI.

That’s because even if we would all love to have a single feed where you can get all the packages in an independent fashion, it is highly likely that some users might not need a CI package but something more refined instead.
With the latter it is clear that the package is not as good as a beta, making it easier to section your offer for the user as you like. CI is really bleeding edge sometimes, and I believe it is good to have it separated from other builds.

Tuesday, 14 February 2017

A note on TFSConfig OfflineDetach

I already mentioned the very useful TFSConfig OfflineDetach in the past. Today I used it once again, and I realised a very important information is missing.

What you need to remember is that the Configuration Database you need to use is the one which has the Collection you want to detach in it. And it must be offline as well.

So in today’s situation (moving a collection across domains in a new instance) I had to restore the configuration database as well as the collection’s.

Monday, 6 February 2017

PRs and ‘Unable to queue Build’ with VSTS

This should never happen, but if it does…


Just go checking the PR settings to verify that there actually is a build linked!


Monday, 30 January 2017

Getting started with Delivery Plans in VSTS

Last week Microsoft released a very interesting extension for VSTS – Delivery Plans.

It is still a very early preview, it will be associated with a business model (so it is likely it won’t be free), and this feature represents a very important expansion of VSTS’ field of execution.

This extension brings a way of tracking the work undertaken by multiple teams at the same time, with the possibility of focusing only on a certain level of detail, and enables scenarios of delivery forecast previously quite hard to achieve.

To easily get started, I suggest installing the Sample Data Widget extension and deploy the “SAFe with VSTS” package. I went for this package because it creates a nice set of Work Items, not because there is any relationship between Delivery Plans and SAFe.

Once this is done, customise the iteration dates and the teams you like – I would go with two sub-teams part of a large team - then assign what you feel is better suited to each team (pretty randomly I reckon given we are just using sample data Smile) and create a Plan like this:


This is a plan designed to give you a full breadth of information, from the larger parts to the finer details. The result is brilliant:


In a single page you will get a timeline view of Epics and Features delivered per-sprint by the whole team, plus the User Stories delivered by each sub-team. This is obviously overkill for the real world – you will want two different plans depending on the level of detail you would like to provide – but it explains why this feature is so powerful and game-changing for me.

Delivery Plans will enable scenarios where stakeholders can easily understand the status of their value streams without using external reporting tools, and this is a crucial step to allow VSTS to grow from a developement-focused tool to a more general purpose in a company.

The documentation is already very comprehensive, take a look there and I strongly suggest to give a go to this extension, given the value it brings.