Most folks using VSTS know that when you create a project in VSTS, there is a backlog created with a hierarchy of backlog items. The default ones I have are Epics and Features. The problem is while this may good good for smaller orgs, its does not work for the enterprise orgs I work with. With on-premesis TFS you can manipulate this in the xml and add your own items. Microsoft is introducing a easy way to do that in VSTS. I find most enterprises use one or both of these levels in the planning. The only thing is that its not out yet. According to Microsoft its coming in Q1 of 2017. So if you are looking to get the functionality keep an eye out in Q1 2017 for it to go live.
Very often when I am working with Releases in Visual Studio Team Services, I end up using variables for vaules in my releases. So before I go much further lets first explain the types of variables that we are going to talk about.
Global Variable – A variable that can be used across all environments in a release definition.
Environment Variable – A variable used in a specific environment in a release definition
So lets say I create a release with two builds and 4 release definitions with three environements each, Dev, QA, Prod. Lets say that I need to create a list of variables that I want to make available to four release definitions. Up until recently I have had to add then into each build or release i want to use them in. This was pretty repetitive. This is where the Variable Groups come in. Variable Groups allow me to create variables one time and use them across multiple releases. At this time the Variable Groups are only available to 2017 release definitions, but will be available for builds in the future. An example of variables I would want to share would be the System.Debug variable. I usually set it to “true” so that the builds and releases have a more verbose logging. I mainly do this as I am creating and testing the builds and releases and then set it to “false” when its ready to go live. Maybe there is a user name or database name that is shared. This is a good candidate for a variable group. So lets see how we can create and use the Variable Groups.
First off log into your VSTS or TFS 2017 and go to the Releases section. You should already have a release definition created before moving on. There is a lot of info on MSDN on how to create release definitions, so I am not getting into it here. Once you have a Release Definition, selct it and put it in Edit mode.
Once in Edit mode select the Variables option.
You will see a statement about Variable Groups with a link at the end. Click the link to manage the Variable Groups.
In the Variable Groups page, click the Variable Group button.
On the New Variable Group page, give the group a name, a description (if you want) and enter the variables. In my case I used the system.debug with a value of true. You will notice that there is a lock next to the value textbox. This allows you to create what is called a secret variable. Its an encrypted value to hide and secure the value. Click Save once complete.
Now go back to the Variables tab in the release definition and click the Variable Group button and select the new group from the dialog that pops up.Click Link once you have selected the group you want to add.
Save and Run the release to test out the new variable.
As you can see from the image above that the system.debug is set to true and the output is quite verbose.
I think this is a great new feature that I will be using in the future on my releases and will look forward to when the Build variable groups are avialable.
If you have been following Azure Stack you probably saw that the Azure Stack TP2 supports AppServices now. I decided to set it up and give it a spin since I use more PaaS services than IaaS. Setup meant I had to redeploy Azure Stack. I ran through the installer for Azure Stack which ran perfectly, just took some time. Next I went through the instructions to deploy SQL Resource Provider. https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-sql-resource-provider-deploy
I was really impressed that the documentation was pretty thorough and in the end was spot on.
Next I ran through the App Services Resource Provider. It turns out I had to do the SQL Provider first in order to do the App Services. I tried App services first and found out the hard way I had to change the order.
I tested the setup just like its spelled out in the docs and I was able to create a database, DNN site, and a web app.
All said it took me a good day to get the setup complete. I was very impressed that the Azure folks created some great docs. Now it’s time to start building and using existing Azure Resource Manager (ARM) templates
So in my last post i pointed readers to resources for setting up a vpn connection to access your Azure Stack environment without having to RDP into a server while I am on my home network. It also allows me to access via Visual Studio as well as have multiple users connect if I choose. So that has been working great, but I need to access Azure Stack while I am on the road, which is often. So I decided to try and setup a VPN connection to my Home and then use the Azure Stack VPN to access the portal from my local PC while traveling. Now i am not a networking guru by any means but I did figure it out.
At first I setup a VPN server using the built in Windows 2016 Remote Access functionality. I must of spent an hour trying to get the connection to work to no avail. I was about to abandon the idea for now until I ran across a VPN sever called softEther. I am sure there are many choices out there, but this is what i ran with. There is a client and a server piece. I installed the server bits on the 2016 server using the default settings. No real configuration. Next I installed the client in my local machine. I was trying to get it to connect but i still was not successful even though they are meant to work together fairly easily. Not sure why yet but I am looking into it.
Not wanting to give up i decided to try and setup the VPN using the Windows 10 client. As soon as i configured it I connected with no issue. I used the following settings.
Now i am using a Pre-shared key which is not as secure as a certificate. So I am going to work on that next. Just wanted to test the theory out.
Now that I am connected i figured i would try the Azure Stack VPN connection to get into the environment. That work straight away and now I can connect to my Azure Stack from my remote machine while on the road.
Now i am new to all this so this may not be the best or easiest way to do this. I feel there is something far more simple than what I have setup, but until I find that I am using what I have. If anyone knows an easier way, please reach out to me on twitter (@pjhacker) so I can implement it. If there is no easier way then here you go. Hope someone can use this info.
Now that I have deployed azure stack I want to access it from my PC rather than remoting into the Azure Stack server.
You can follow these instructions for connecting to Azure Stack via a VPN:
This is nice because i can now access through my local browser.
EDIT: Here is how I set it up. I have had a couple questions about the setup so I will post what I ran.
Import-Module D:\AzureStack.Connect.psm1 – Download from the link above and save to a local directory path
$Password = ConvertTo-SecureString “<AzureStack Admin Password>” -AsPlainText -Force
# Add Azure Stack One Node host to the trusted hosts on your client computer
Set-Item wsman:\localhost\Client\TrustedHosts -Value “ip address of host” -Concatenate
$natIp = Get-AzureStackNatServerAddress -HostComputer “ip address of host” -Password $Password
# Create VPN connection entry for the current user
Add-AzureStackVpnConnection -ServerAddress $natIp -Password $Password
# Connect to the Azure Stack instance. This command can be used multiple times.
Connect-AzureStackVpn -Password $Password
#winrm quickconfig -transport:https
In my last post i talked about getting started with the deployment of Azure Stack POC TP2. In this final post on the experience there is not much left to say. I had hit a roadblock and was not able to get past step 22. I asked in forums and scoured the net but nothing. I was going to just give up for a while when i found a post that was talking about the time changing on the server could be an issue. I looked back through the steps in my deploy and saw that the step did change the time and therefore may be the issue. So now that i have a direction (right or wrong) and i was running with it. The first thing i did was to just rerun the deployment since i figured the time change completed and it would not effect it this time, again right or wrong it was a direction. Low and behold it flew past step 22 and by late last night i had a full deploy of Azure Stack on my server. I was pretty impressed with the install. Sure i ran into a couple issues, some from not reading carefully enough and some i cannot explain why, but its done. I will say that the forums were not a big help right now. I am sure that will change as it gets used more, but the answers to my questions all came from searching the internet and trial and error. I will of course work in the forums to see if I can help anyone as i go through using it.
I decided that i was going to deploy the Technology Preview 2 of Azure Stack (Azure on my hardware). I have a pretty hefty server with the following:
- 2) 6core CPUs
- 192 GB Ram
- 12TB storage – 4drives x 3TB each
- 1) 500GB OS drive
To start, I need to go into the Azure portal and create a new user in a directory that has administrator rights. I struggled a bit with this because i was using my Azure account that i access with my Microsoft account. This is not allowed from what I can see. It must be a non-Microsoft domain account (you can use your company domain). For me that meant that I had to buy a new domain name, which i did and found that I could get myazurestack.com, so i bought that. Now that I have a domain I logged into Azure using my MS account, created a new user with the @myazurestack domain. I then created a new AD directory (in old portal) and added the new user to that directory.
Next I downloaded Azure Stack POC TP2. Once I have that I extract the files. You need to run the Azure Precheck ps1 file to ensure that your machine meets the minimum requirements. You get that here. I also ran the vhdx extract. Its the .exe file in the downloaded files
So now that i have a valid server, and an Azure domain account I ran the BootToVHD.ps1 powershell script so that I can reboot into the CloudBuilder.vhdx virtual machine. The reboot took a bit since it rebooted twice. Then asked for some info and to set an administrator password.
Once i logged in i ran the InstallAzureStackPOC.ps1 file like so:
Now here is where I made mistakes. I first off formatted and initialized the 4 disks that I will be using. Bad move, they need to be left Unallocated (no volume). So when it got to step 18 it failed to find any disks. After digging around for a quite a while i read that in order to create a storage pool in windows, I need to have unallocted disks. Since this is what step 18 is trying to do I decided to give it a try. That worked and I got past step 18. I figured we were on our way to deploying. Not so fast, I ran into another error on step 19. Bottom line was that I need to log into the server with the AzureStack\azurestackadmin user. I went back and looked and I apparently missed the part where it stated that was what I needed to do. So make sure you login to the server with that user. So i am currently on my way to deploy, but it failed on step 22 (Task: Invocation of interface ‘Configure’ of role ‘Cloud\Fabric\BGP’ failed: ) and I had to ask in the Azure Stack forums whats going on. I looked around and found no info on that step or error, which i figured would be the case since its so new. I will report back as soon as I get going again.
This month i have really put my self out there. I have quite a few code camps to speak at. I have listed them here since i get asked about it. Now I’ll just point folks here.
October 2 – Silicon Valley Code Camp
October 5 – DogFood Conference
October 8 – Desert Code Camp
October 14 – DevSpace
October 20 Little Rock Tech Fest
October 26 Prairie.Code()
October 28 Raleigh Code Camp
Hope to see some of you at these events as they are all bound to be good conferences. The folks putting these on do a fantastic job and should be commended for all they do.
I recently created an MVC 5 app in VS 2015 and tried to build it with VSTS. It failed every time even though it built fine i VS 2015. It appears the issue is the NuGet packages that are stored in VSTS. I deleted the packages directory and rebuilt the solution with VSTS and everything worked fine. I am not sure why it fails this time compared to all other times i have created a solution with a packages directory in VSTS, but i will need to dig in and find the answer.
Here is the actual error I get.
The “Microsoft.CodeAnalysis.BuildTasks.Csc” task could not be
loaded from the assembly …\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly ‘file:///…\packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.Build.Tasks.CodeAnalysis.dll’ or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
So i demo the new VSTS build features and one question i get a lot is “What’s the difference between MSBuild and the Visual Studio Build steps?” so I am going to list out some reasons for using one or the other.
Lets say you dont want to build an .sln file to build but rather the .proj files. Then this is the option could use. It also does not require Visual Studio to be deployed on the build server.
If you want to build multiple projects, specify search criteria. You can use a single-folder wildcard (
*) and recursive wildcards (
**). For example,
**\*.*proj searches for all MSBuild project (.*proj) files in all subdirectories.
Make the sure the projects you specify are downloaded by this build definition. On the Repository tab:
- If you use TFVC, make sure that the project is a child of one of the mappings on the Repository tab.
- If you use Git, make sure that the project or project is in your Git repo, in a branch that you’re building.
If you are building a solution, in most cases you should use the Visual Studio Build step. This step automatically:
- Sets the
/p:VisualStudioVersionproperty for you. This forces MSBuild to use a particular set of targets that increase the likelihood of a successful build.
- Specifies the MSBuild version argument.
Information about how to implement the steps are here in the MSDN library.
So i just stumbled across this feature in Azure. Its the ability to export templates of resource groups. This is wicked cool. I could have used this months ago. What i like (there is a lot to like) is that I can use it as a great teaching tool. If i am looking to automate my deployments and I get stuck on a particular item, i can easily create it in the UI then export the template to see how i would code it up. Its really easy to do. Just go into the Azure portal and select a Resource Group you want to export.In the settings you will find the “Export Template” option.
Click on it and it will produce the the template with some options to download, save, or even redeploy it. This is what i need so I am going to download it locally and start to work on it.. You also have the option of clicking through the resources, parameters, and variables. Not only does it show you the resources, but you also have the option to view the Powershell or CLI code.I also like the fact that it gives me the parameters file i can use and build off of.
I have been waiting for this functionality for a while now and its nice that the team has released it finally. I will definitely using this feature in the future.
I have been doing a series of webcasts on YouTube around TFS/VSTS Build. i was approached by the folks at CatLight to demo that in the videos i do. I decided to look at the tool and write aa post first.Its a free download and easy setup to get it running. It sits in the tray and turns colors based on a build. Red means there is a failed build on one of your projects, amber is a partial completion. Just the cat outline mean your good. Click on the cat icon in the tray opens the Dashboard where you can configure what projects you want to monitor as well as the current status of the builds for each project. Click on the build name in the Dashboard and i takes you to that build summary. I can see the usefulness in the tool, as a visual way to stay on top of builds. Of course there are other ways to do it also. If this sounds interesting go to http://catlight.io and check it out.