VSTS-Tools now on GitHub

API, Utilities, Visual Studio Online
Several of the past few posts that I have published have revolved around various Visual Studio Team Services (VSTS) REST API calls (you can click on the “View API Articles” button to the right to view the list of articles). Rather than relying purely on blog posts to provide example source code for these REST API calls, I thought I’d start making them available in a GitHub repo.Introducing VSTS-Tools!You can find the initial release on GitHub here: https://github.com/jbramwell/VSTS-ToolsThe initial release contains code examples for two command-line utilities:VSTS-Get – CLI to download a single file or entire folder tree from VSTS (only Git is supported at this time).VSTS-Keep – CLI to set (or remove) the “Retain Indefinitely” retention flag for a given build.You can find documentation on how to run the…
Read More

Download a File using VSTS REST APIs

API, Visual Studio Online
Adding yet another post related to Visual Studio Team Services (VSTS) REST APIs, I thought I’d cover an example of how to download a file from a Git repo in VSTS using the REST APIs (I will cover TFVC-based repositories in another post). In the example below, I will be using C# to make the API calls. However, you can use whatever approach makes the most sense for you (e.g. JavaScript, PowerShell, etc.).If you are new to calling the VSTS REST APIs or you are new to this series of articles then I would recommend on clicking the View API Articles link above to get started.Rather than spend time on how to authenticate with the VSTS APIs or how to deserialize API results into POCOs, I will simply highlight the…
Read More

Calling VSTS APIs with PowerShell

API, Visual Studio Online
Continuing along with my other various examples of VSTS API calls, I thought I’d include an example on how to call a Visual Studio Team Services REST API using PowerShell.To provide a concrete example, consider this scenario:We use VSTS-based builds to build our projects and create artifacts (e.g. web apps/services, binaries, etc.). We then make use of Octopus Deploy to deploy our artifacts into our various environments (e.g. development, test, production, etc.). Once these artifacts have been deployed to the production environment, we’d like to keep them around indefinitely.As you are likely aware, VSTS has a default retention policy on builds of 10 days with a maximum retention of 30 days. That is, unless you manually switch the retention for a build to “Keep Forever”. This can be accomplished easily…
Read More

VSTS Keyboard Shortcuts

Tips, Visual Studio Online
Computers have been part of my daily routine for many years now (over three decades!) and I’ve used a lot of software in that time. My primary applications tend to include various software development tools (such as Visual Studio, ReSharper, Fiddler, etc.), productivity software (such as Microsoft Office, various text editors, etc.) and so on. Over the years, I’ve found that if I used a command more than twice in a single session, I will take the time to learn the associated hotkey sequence – assuming one exists. For example, in Visual Studio, I tend to build the source code many times so Ctrl+Shift+B (or F6) is ingrained in my muscle memory. When I want to format the source code for an open code file, I’ll press Ctrl+K, Ctrl+D without…
Read More

Discovering VSTS APIs

API, Visual Studio, Visual Studio Code, Visual Studio Online
Building on our current theme of Visual Studio Team Services (VSTS) API calls, let’s take a look at discovering what APIs are available.The likely starting point for figuring out VSTS APIs is the REST API Reference for VS Team Services and TFS. Here you can view the various information and examples for the APIs currently exposed by VSTS (and TFS). The APIs are broken out into major categories with each category including links to the various resources provided by their respective APIs as shown in the excerpt below:If you’re like me, however, you might enjoy viewing the available APIs just a little bit closer to the “metal”. This is relatively simple with VSTS because Microsoft has implemented the HTTP OPTIONS method. While you wouldn’t necessarily want to use the OPTIONS…
Read More

Calling VSTS APIs with C#

API, Visual Studio, Visual Studio Online
In the last API-related article, Personal Access Tokens and VSTS APIs, we looked at how we can use Fiddler, along with a Personal Access Token (PAT), to query the Visual Studio Team Services (VSTS) REST APIs. In this post, we’ll take a look at how we can use a 3rd party Fiddler extension, Request to Code, along with the “Paste JSON as Classes” Visual Studio feature to jump start the process of calling VSTS APIs with C#. Pre-Requisites – Install the Extension Before we get started we must make sure we’ve installed the Fiddler extension Request to Code. On the extension page, click on the download link to download the extension. It will come down as a ZIP file that contains a DLL along with a few other files. To…
Read More

Personal Access Tokens and VSTS APIs

API, TFS, Visual Studio Online
One of the great features of Visual Studio Team Services (VSTS) and Team Foundation Server (TFS) is its extensibility model. I am specifically referring to the REST APIs that Microsoft has started making available for their platform. Until recently, you had two options for authenticating with the REST APIs:Basic Authentication – requires that you enable alternate credentials on your VSTS/TFS account, Base64-encode them and send them “over the wire” along with your REST API call. This approach is simple though not very secure since your credentials are not encrypted “at rest” (though they are encrypted when used since the APIs utilize HTTPS at the transport layer). You can read more about using Basic Authentication with the REST APIs here.OAuth – this is a more secure approach than Basic Authentication, however…
Read More

PSA: Backup Your BitLocker Key

OneDrive, Security, Tips
Windows BitLocker Drive Encryption is a feature integrated into Windows that allows you to encrypt data stored on your computer/tablet. For the most part, everything “just works” and you never have to think about BitLocker once you’ve enabled it on your computer. However, it is possible that BitLocker could encounter an issue or condition that prevents it from being able to unlock your drive. If you’ve encrypted a portable drive using BitLocker to Go, and you’ve forgotten the password, you will not be able to retrieve your files. That is, unless you have a BitLocker recover key. Creating a BitLocker recovery key is fairly quick and simple. You also have multiple options of where/how to store your recovery key. To create a BitLocker recovery key (for Windows 10): Press the…
Read More

VSTS/TFS Feature Index

TFS, Visual Studio Online
While the Visual Studio Team Services (VSTS)/Team Foundation Server (TFS) 2015 Feature Index has been out for a little while now, I’m not sure how many people actually know about it. If you’re somewhat familiar with VSTS/TFS then you are aware that you can use the VSTS/TFS platform to manage your source code, track work items and even run automated builds and deployments. But are you aware of everything else that can be accomplished with VSTS/TFS? You might be surprised!I am not going to detail everything the index covers because there is simply too much. However, here’s a high-level list of the categories within the index:Access and supported clientsAgile tools to plan and track workBacklogsBugs, tasks and issue trackingCustomize (TFS)Customize (VSTS)KanbanScaleScrumWorkflowAlerts and notificationsCodeGitTFVCPackage management (VSTS)Continuous DeliveryBuildRelease (VSTS – Preview)TestDashboards and…
Read More

Personal Access Tokens & VSTS

Visual Studio Online
If you happen to be using Git-based projects in Visual Studio Team Services (VSTS – formerly known as Visual Studio Online) then you might have already encountered Personal Access Tokens – or, PAT, for short. If you are not familiar with PATs in VSTS then read on… :-)As you are already aware, you can sign into VSTS using a Microsoft Account or, if your VSTS account is tied to Azure, an Azure Active Directory account. This approach works great when using the web-based interface for VSTS or when using Microsoft tools such as Visual Studio, both of which provide inherent support for Microsoft and AAD Accounts. If you are making use of 3rd party tools such as the Git command-line interface, SourceTree, etc., then the account types mentioned above don’t…
Read More