Publish symbols to Azure File Storage with the VSTS Hosted Agent

A while ago I migrated a lot of builds to the Visual Studio Team Services Hosted Agents. This works great. We reduced the number of build servers and agent on-premises and can now easily scal up and down. But .. as it goes… there is always that next thing on the list.

In my case this was, setting up a Symbol Server. We needed this because we spent a lot of time breaking up our big solution into smaller, independent components. To make the debugging life a little less painful, the Symbol Server can help.

When using on-premises build agents, setting up a Symbol Server is very easy. You just add the Index Sources & Publish Symbols Task to your Pipeline, point to a network location (UNC path) and you are good to go !


But.. the UNC path is exactly the thing that is not available on the VSTS Hosted Agent, because the Hosted Agent cannot access our own network.

Stuck! But there is a way !

Azure File Storage as Network Share

Azure has a service File Storage. This allows you to create a storage account and have a folder that you can access as a Network Share (SMB).  Just create a storage account, and in the Files section you can create a new Share. This is described perfectly here.

When you created the share, you can access it by using the “net use” command. Make sure you have outbound port 445 open on your network.


Setting the network share on the VSTS Hosted Agent

After that it is time to use it in your build. For that, the Hosted agent must be able to access the network share. Add a Command Line Build Task and execute the [net use] command.

ESSENTIAL: be careful to remove the [Driveletter]. This is optional. If you remove that, you sttore the credentials for the UNC Path, but you still need to access it by the UNC path instead of the drive letter!

net use \\\sharename 
/u:AZURE/username <generatedpassword>

Then add a Index Sources & Publish Symbols task, and point to the network UNC path



Run the build on the hosted agent, and you see the symbols appear in Azure

Pointing Visual Studio to the Symbol Server

Locally, execute the net use command as well.Point Visual Studio to the Symbol Server as described here and you are good to go !

Hope this helps !


2 Responses to “Publish symbols to Azure File Storage with the VSTS Hosted Agent”

  1. Thanks for this post. This is a pretty slick way of using symbols until VSTS publishes their own symbols server. I do have one issue though. For some reason visual studio will not pull down the symbols for the azure file share. I connected the drive and everything seems to be working just fine except the symbols aren’t being pulled into the local cache. If I move the symbols to a local network share it works fine. Any thoughts of what I need to do to enable visual studio to access the share?

    • If you execute the same command in windows explorer you can connect to it. You can also create a network drive so the credentials are kept at restart. Use the UNC path in the symbol share settings !

%d bloggers like this: