Tech Days Online

Next week it all happens again! For the fifth year Microsoft United Kingdom is running its TechDays Online event—at no cost to attend. Covering the top topics in IT today, you can watch all the live stream action May 18th and 19th from 9:30am – 5:30pm. Register to attend or catch-up on all the great content here.

As in past years, this popular event has attracted noteworthy speakers from across Microsoft's technical community, including many, many MVPS. The focus this year will be Intelligence and DevOps.

On Wednesday, May 18th, the presentations will feature Analytics on Azure and Cortana Intelligence and explore Microsoft's Intelligent Cloud and the interconnected services called the Cortana Analytics Suite. Technical experts already building these services will explain what these services are, how they fit together to enable organizations to leverage their data and share their own experiences.

On Thursday, May 19th, the theme shifts to DevOps with the MVPs and community leaders talking about the latest practices to enable organizations to increase efficiency. Throughout the day the main technologies discussed will enable viewers to implement DevOps practices within their own organization. As with day one, technical experts and MVPs already taking advantage of these practices will share their journey and real-world experiences with DevOps.

 Here's the agenda (subject to change):

Day One;

Day Two;

Cleanup the GlobalList.Xml

TFS has been using the GlobalList.xml file to store builds since 2010. This Global List is used in several workitems as the suggested list of values. For example, in the Bug there are two fields that use this Found In and Integrated In. These drop down fields present a list of builds that comes from the GlobalList.

Although it's not the great solution and I hear it's changing. It's what we have had for 6 years so we have used it. I have many clients that rely on these work item fields and therefore the list of builds.

However, when you delete a build it cleans up a lot of stuff, including the label, Drop Folder, Symbols and Test Results. But not the entry in the GlobalList. L

Ours was getting out of hand. So I built a Powershell script that I could run that would clean up the Global List by checking to see if the build had been deleted from TFS. If it was removed it removes the build from the list. Because this list is implemented as a Suggested list in the work items removing them has no effect on the old workitems referring to this build. They will still have their value. It just means the cleaned up build will not be in the list to be selected anymore.

[Update on Nov 24 2016] I have since cleaned up and fixed this Powershell script. The Script does not upload until you set $UpdateServer = 1

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Client")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Common")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client")  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client.VersionSpec")  
 
Add-Type -AssemblyName System.Xml
 
cls
#Add the Entry to the Global List 
 
[string] $GlobalListFileName = "D:\Temp\GlobalList.xml"
[string] $NewGlobalListFileName = "D:\Temp\NewGlobalList.xml"
$RemovedBuilds = new-object System.Collections.ArrayList
[String] $GlobalListName = "Builds - NBFC"
[string] $tfsServer = "http://tfs.nbfc.com/tfs/products"
[string] $witadmin = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\witadmin.exe"
[bool] $UpdateServer = 0
 
function GlobalList( [string] $action, [string] $GlobalList)
{
 
    $arguments = $action + ' /collection:"' + $tfsServer + '" /f:"' + $GlobalList + '"'
    write-host $witadmin $arguments
    #start-process -FilePath $witadmin -Argumentlist $arguments -wait -WindowStyle Hidden
 
    $pinfo = New-Object System.Diagnostics.ProcessStartInfo
    $pinfo.FileName = """$witadmin"""
    $pinfo.RedirectStandardError = $true
    $pinfo.RedirectStandardOutput = $true
    $pinfo.UseShellExecute = $false
    $pinfo.Arguments = $arguments
    $p = New-Object System.Diagnostics.Process
    $p.StartInfo = $pinfo
    $p.Start() | Out-Null
    $p.WaitForExit()
    $stdout = $p.StandardOutput.ReadToEnd()
    $stderr = $p.StandardError.ReadToEnd()
 
    if ($p.ExitCode -eq 0)
    {
        Write-Host "$action Successful"
           Write-Host "stdout: $stdout"
    }
    else
    {
        Write-Host "$action Failed" 
        Write-Error "Error: $stderr" 
        exit $p.ExitCode
    }
    $p.Close()
 
}
 
GlobalList "exportGloballist" $GlobalListFileName
 
#Load the contents of GlobalList.xml
[xml]$doc = Get-Content($GlobalListFileName)      
$root = $doc.DocumentElement
$BuildsList = $root.SelectSingleNode("GLOBALLIST[@name='$GlobalListName']")
 
#sort the list of builds
$orderedBuildsCollection = $BuildsList.LISTITEM | Sort Value
$BuildsList.RemoveAll()
$orderedBuildsCollection | foreach { $BuildsList.AppendChild($_) } | Out-Null
 
#Connect to TFS and get the Build Server
$server = new-object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection(New-Object Uri($tfsServer))
$buildServer = $server.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
 
#Create a list of builds that are no longer in TFS
foreach ($child in $BuildsList.ChildNodes)
{
    [array]$items = $child.value.Split("/")
    [string]$buildDefinitionName = $items[0]
    [string]$buildNumber = $items[1]
    #Look in the XAML Builds List 
    $buildDetail = $buildServer.QueryBuilds("NBFC", $buildDefinitionName) | ? { $_.BuildNumber -eq $buildNumber }
    if ($buildDetail)
    {
       write-host "$($buildDefinitionName) - $($buildNumber) is Valid"
    }
    else
    {
        $apicall = "http://TFS.NBFC.COM:8080/tfs/Products/NBFC/_apis/build/builds/?api-version=2.0&DefinitionName=$buildDefinitionName&buildNumber=$buildNumber"
        $apicall
        $json = invoke-RestMethod -uri "http://TFS.NBFC.COM:8080/tfs/Products/NBFC/_apis/build/builds/?api-version=2.0&DefinitionName=$buildDefinitionName&buildNumber=$buildNumber" -method Get -UseDefaultCredentials
        if ($json.count -eq 0)
        {
            $RemovedBuilds +=  $child.value
            write-Warning "$($buildDefinitionName) - $($buildNumber) Will be Removed"
        }
        else
        {
            write-host "$($buildDefinitionName) - $($buildNumber) is Valid"
        }
    }    
}
 
#[xml]$mainlist = get-content $GlobalListFileName
 
foreach ($toRemove in $RemovedBuilds)
{
    $query = "//LISTITEM[@value=""$toRemove""]"
    write-host "Select node $query"
    $BuildNode = $doc.SelectSingleNode($query)
    if ($BuildNode)
    {
        $BuildNode.ParentNode.RemoveChild($BuildNode)
    }
    else
    {
    write-host "Can't find Entry $toRemove"
    }
}
 
#Sort the list 
#$orderedBuildsCollection = $BuildsList.LISTITEM | Sort Value
#$BuildsList.RemoveAll()
#$orderedBuildsCollection | foreach { $BuildsList.AppendChild($_) } | Out-Null
 
$doc.save($NewGlobalListFileName)
 
 
if ($UpdateServer)
{
    GlobalList "importgloballist" $NewGlobalListFileName
}

TFS chart size limits

TFS is an excellent ALM/DevOps tool. Very flexible ALM/DevOps tool. You can do a lot with it. A lot. Once in a while though, like with any other tool, you hit a hurdle that prevents you from doing what you and/or the customer is trying to do with TFS. For example, recently I encountered the following error: VS402395: The daily number of work items returned exceeds the trend chart size limit of 1000. An error was caused because the customer was trying to build a chart from a query that returns more than 1,000 work items. I questioned why would they need a chart for a query that big, and the customer seemed to have a good reason to have chart for that many items. I might not agree with that reason, but the customer thought it was important, so I've promised to look into it.

And, of course, if there is a will, there is a way. Especially, if you're dealing with a flexible and feature rich TFS. TFS has a very rich API. And, almost always, if there is something that you cannot do in UI, you can do via API. Just like in this case. Even though, there was no way to by part chart size limit, there is a very straightforward to get it done using API. OK, enough talk. Here is how you can change chart size limit using PowerShell and TFS API:

 

# Load TFS snapin

if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )

{

Add-PSSnapin Microsoft.TeamFoundation.PowerShell

}

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Common")

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.WorkItemTracking.Client")

 

$tfsCollection = New-Object -TypeName Microsoft.TeamFoundation.Client.TfsTeamProjectCollection TFS_COLLECTION_URL

$hiveCollection = $tfsCollection.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry])

 

Write-Output "The current value of chart size limit is:"

$hiveCollection.GetValue("/Service/WorkItemTracking/Settings/MaxTrendChartTimeSliceResultSize")

Write-Output "Changing the chart size limit to 1500 (maximum)…"

$hiveCollection.SetValue("/Service/WorkItemTracking/Settings/MaxTrendChartTimeSliceResultSize", 1500)

Write-Output "The new setting for a chart size limit is:"

$hiveCollection.GetValue("/Service/WorkItemTracking/Settings/MaxTrendChartTimeSliceResultSize")

 

 

That's it. Have a good day J

Trigger a Release add the Build to GlobalList

This was never the best solution but it worked. When a build executed it would be added to the Collections Global List. Then it could be used as the source for drop downs like Found In Build and Integrated In Build.

If you are stuck in that place between TFS 2015 U1 and U2 you have the news builds but you don't have the new Release manager yet these two PowerShell Scripts might come in Handy.

There are so many environment variables you can use to get information about the build that you are a part of, the CollectionURI, SourcesDirectory and so on. You can check them all out here.

To save space I have left out error checking.

  1. Trigger a release in ReleaseManager from the 2015 vNext build

# Environment Variables

Write-Host "URI: $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"

Write-Host "Project: $env:SYSTEM_TEAMPROJECT"

Write-Host "Build Def: $env:BUILD_DEFINITIONNAME"

Write-Host "Build Number: $env:BUILD_BUILDNUMBER"

 

[string] $TFSUri = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI

$TFSUri = $TFSUri.Replace("/tfs/",":8080/tfs/")

write-host "URI - $TFSUri"

 

$binaryLocation = join-path (Get-ItemProperty $registrykey[0]).InstallDir "bin\ReleaseManagementBuild.exe"

 

# Call Release Management Build

&"$binaryLocation" release -tfs "$TFSUri" -tp "$($env:SYSTEM_TEAMPROJECT)" -bd "$($env:BUILD_DEFINITIONNAME)" -bn "$($env:BUILD_BUILDNUMBER)"

 

 

  1. Add the Build to the GlobalList

#Use Environment Variables to get Build Information

[String] $GlobalEntryValue = "$env:BUILD_DEFINITIONNAME/$env:BUILD_BUILDNUMBER"

 

#Some other information that you will need

[string] $GlobalListFileName = "GlobalList.xml"

[String] $GlobalListName = "Builds - MyProject"

[string] $tfsServer = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI

[string] $witadmin = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\witadmin.exe"

 

#Export GlobalList

$arguments = 'exportGloballist /collection:"' + $tfsServer + '" /f:"' + $GlobalListFileName + '"'

write-host $witadmin $arguments

start-process -FilePath $witadmin -Argumentlist $arguments -wait -WindowStyle Hidden

 

 

#Add the Entry to the Global List

Write-host "Add build $env:BUILD_BUILDNUMBER to $GlobalListName"

[xml]$doc = Get-Content($GlobalListFileName)

$List = $doc.GLOBALLISTS.GLOBALLIST | ? { $_.Name -eq $GlobalListName }

$build = $doc.CreateElement("LISTITEM")

$build.SetAttribute('value',"$env:BUILD_DEFINITIONNAME/$env:BUILD_BUILDNUMBER")

$List.AppendChild($build)

$doc.Save($GlobalListFileName)

 

 

#Import GlobalList

$arguments = 'importgloballist /collection:"' + $tfsServer + '" /f:"' + $GlobalListFileName + '"'

write-host $witadmin $arguments

start-process -FilePath $witadmin -Argumentlist $arguments -wait -WindowStyle Hidden

 

Microsoft Events

TechNet Virtual Summit

3 days of expert content on IT shifts, career insights, security, mobility, tech innovations and more. Hear firsthand where IT is heading, from some of the best tech minds in the business. Join us online March 1-3 right from your favorite connected device. Register here: http://aka.ms/tnvcmvp and share with your community! Note:  sessions will be delivered in PST Time.

Let's Dev This Tour in Montreal

On March 30st, Let's Dev This Tour is coming to Montreal to present 3 different tracks on Web, Cloud and Windows 10. To know more about each session simply click on it.

Microsoft DevOps Hackathon

DevOps Hackathon is happening in Montreal on March 18-19th and in Ottawa on March 31st- April 1stPlease see below call for MVP Proctors.

MVP Open Day 2016 – this year's Canadian MVP Open Day will take place on Friday, May 6th, 2016 (8:30am – 5pm EST). Please make sure you register here

ITI Cloud Roadshows: Join local IT professionals and Microsoft MVPs in the following cities:

MVP Days Community Roadshow: coming to Toronto Feb 29th, Ottawa Mar 2nd, and Montreal Mar 4th, 2016. We are hoping you are able to register for these events. Please help us spread the word.

SharePoint Saturday Montreal: Register for the 4th Edition of SharePoint Saturday in Montreal on April 2, 2016. Five tracks offered: IT Pro, Dev, End-User, Business Customer Showcase and Data SQL. Call for Speakers and Sponsors are open!

Prairie Dev Conference: 2-days Development Conference happening in Winnipeg on April 11-12th, 2016 - http://www.prairiedevcon.com/

MVP Community RoadShow

There's just one week left for MVPDays Community Roadshow in Toronto!

We would love to see you there!

Please use the Promo Code "CDNMVP" to register for FREE !

 

Make Web Not War

 

Make Web Not War brings together Canadian web dev experts to talk about modern web standards, Open Source, and Open Data innovations. Learn about the latest IETF & ECMA web standards, how to run and contribute to open source projects, the importance of open data in the world of journalism, open government, and more. Live online Feb 5, 2016. Participation is free. Register to receive exclusive content to accompany the live presentation.

 

URL: https://aka.ms/mwmvp

LET’S DEV THIS!

#LetsDevThisToronto

 

Awesome apps are built a certain way – that way may be different for each and every one of us. On February 10, Microsoft DX is coming to Toronto with Let's Dev this Tour to help you learn how to build awesome apps for web, cloud and Windows 10 using latest standards and tools. The day will be full of great workshops, hands-on-labs and consultations with experts.

 

1 DAY. 1 VENUE. 3 DEEP DIVE WORKSHOPS – WEB. CLOUD. WINDOWS 10.

 

Pick a primary workshop, then pop in and out of all three based on the topics that interest you the most.

 

 

 

WEB

The boundless web

Build across browsers, devices, and the cloud.      

Sessions and hands-on labs on the latest dev standards and tools‚ Web Apps with Node.JS‚ and Azure.   

 

 

 

 

CLOUD

The fusion of apps and the Cloud

Magic happens when the technologies that you love live on Azure.

Sessions and hands-on labs on App and Data Services‚ VMs, and networks.

 

 

 

WINDOWS 10

One app fits all

One app can fit them all
– mobile, tablet, and PC
– with Windows 10.

Sessions and hands-on labs on Adaptive UX‚ the Universal Windows Platform‚ speech recognition, data binding‚ and Azure.

 

SPACE IS LIMITED per workshop so please reserve you seat now.

Excluding weekends in Azure Automation Runbooks

Getting Azure Automation runbooks to shut down your virtual machines (or turn them on) automatically is not new. There are a lot of scripts out there that could do it for you. You can also write one yourself. It's not that complicated. I did it J Just kidding…

There are a couple of ways my PowerShell scripts are different:

  1. First, the scripts that automatically start/stop Azure virtual machines take the weekend into account. Scripts will not turn your machines on or off on the weekends. After all, you probably do not want to automatically turn on your virtual machines in Azure early in the morning on the weekend, just so that you can turn them off at the end of the day on the weekend. Seems like a waste, right? Anyways, this small change should save you a few bucks.
  2. Second, the scripts adjust the schedule from UTC to the time zone you need. It looks like when the scripts that are part of Azure Automation runbooks run, they use UTC time. So, if you're in Toronto, script will think that the weekend starts 5 hours earlier. It's not bad, I guess. But, it also means that the weekend will end 5 hours earlier, and that just not right and need to be fixed.

Below is a code snippet that makes the above mentioned happen:

$UTCTime = (Get-Date).ToUniversalTime()

$TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById("Eastern Standard Time")

$LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ)

$day = $LocalTime.DayOfWeek

if ($day -eq 'Saturday' -or $day -eq 'Sunday')

{

Write-Output ("It is " + $day + ". Cannot use a runbook to start VMs on a weekend.")

Exit

}

 

The complete scripts that start or stop Azure virtual machines can be downloaded from OneDrive. Enjoy.

Accessing Git from Behind the Proxy

So, you have installed Git client and trying to connect to Git server (on Visual Studio Team Services, Github, or whatever), but you're getting "fatal: unable to connect a socket (Invalid argument)" error. One of the reasons could is that you're behind the proxy. For example, you're at work and your employer requires all internet traffic to go through the proxy. ~/.gitconfig global config file is the key here. In this case, to get Git client to work with the proxy, you need to configure http.proxy key in git config using one of the following commands:

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

or

git config --global https.proxy https://proxyuser:proxypwd@proxy.server.com:8080

  • change proxyuser to your proxy user
  • change proxypwd to your proxy password
  • change proxy.server.com to the URL of your proxy server.
  • change 8080 to the proxy port configured on your proxy server

If you do not need to authenticate to proxy, then just specify proxy server name and port number and skip proxy user and password.

 

If you decide at any time to reset this proxy and work without (no proxy), use one of the the following commands:

git config --global --unset http.proxy

or

git config --global --unset https.proxy

 

Finally, to check the currently set proxy, use one of the following commands:

git config --global --get http.proxy

or

git config --global --get https.proxy

 

By the way, to retrieve the proxy settings you're using, you can use one of the following commands:

reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | find /i "proxyserver"

or

netsh winhttp show proxy

That's all I got to say about Git and proxy server.