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 !


No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: