...building hybrid clouds that can support any device from anywhere
Okay Readers – Here we go!
Here is the first of six posts in the MVP Spotlight Series for the Automation Track…
Jim Britt of Microsoft gave us a really unique tool for SMA that is highly useful, the SMA Runbook Toolkit (or SMART as it is affectionately known). This is a wonderful tool for tracking your Runbooks and storing them in TFS. The solution we built internally uses Jim’s SMART as a foundation and inspiration but does not use it as a dependency. In our environment instead of using SMA as the source of truth and exporting changes to TFS we instead use TFS as the source of truth and sync the Runbooks and variables in TFS to SMA.
Here (color portion) is a look at where this post fits in to the overall example Solution Architecture:
Looking for the downloadable content?
Here it is!
Download the TFS-SMA Integration from TechNet Gallery here:
This has some huge benefits!
It is assumed that your structure inside of TFS follows the format below
In our environment this looks like…
(here it is the download again)
Download the integration bundle from TechNet Gallery.
Once downloaded place extract the zip file onto your SMA server and edit the .\SMAContinuousIntegration\Environment\SMAContinuousIntegration.xml file.
This file contains a number of things that need to be configured to your environment. Everything but the credential object will be created for you installation script based on the values in this file. Simply modify the values in this file to correspond to your environment.
Once this file is modified simply run the deploy.ps1script as a user that is a SMA Admin (on the SMA box itself)
This will import everything and start your monitor!
It will also take an export of all of your current Runbooks, variables and schedules and check them into TFS for you (anything in your environment that is not in TFS will be cleaned up and deleted in the future!). It places these files in a new ‘ExportedRunbooks’ folder in your TFS workspace
Use TFS to create a new folder
Create the branching structure under this project to relate to each of your SMA environments. Remember, you defined the TFSSourceBranch above. Each SMA environment should have its own source branch name. In our environment we have 3 SMA environment, Dev / QA / Prod so we make 3 branches. We use very basic features of branching (merge with a simple hierarchy). For more information on branching check out Channel 9.
Now all you need to do is author a workflow and check it into TFS. The scripts will do all rest (importing the script into SMA)
This solution allows you to define what variables and schedules are inside of your SMA environment as well. Each Runbook will have a configuration file created for you in TFS. In the configuration file you can put the information about your variables and schedules. This is very important to track in TFS as it facilitates good change control. When we promote our Runbooks from Dev -> QA -> Prod we do not want to modify the actual script files (PS1) we instead want to modify the configuration files. These configuration files should be treated much like web.config files from website development. Everything in your script that will change from Dev -> QA -> Prod should be pulled out into a SMA Variable and, in this solution, stored in a configuration file.
Now that your variables have been created, just reference them as normal in your script
Now you want to promote it to QA? Just do a merge and check it in!
This also works for rolling back changes with TFS
Hopefully you find these examples useful and a good starting place. With this in place you are one step closer to having a fully functional local development strategy for SMA! Another great resource to check out in this pursuit (and one that we leverage internally) is from Joe Levy of Microsoft fame. Check out his blog post Authoring SMA Runbooks in the PowerShell ISE.
And now a few notes from me (Charles)…
Be sure to check out Ryan’s session from TechEd North America 2014!
In this session, see a real-world implementation of a fully automated IT service catalog developed by a Fortune 500 company for supporting self-service requests. This service catalog is based in Microsoft SharePoint and utilizes the newly released Service Management Automation (SMA) engine. During the session we look at how the solution is architected, cover integration between SMA and SharePoint, build a new service offering from the ground up, and share the best practices we have developed for doing work with SMA along the way. So what’s the best part? You get access to the solution we create, so you leave with access to a working solution to help get you started!
Speakers: Ryan Andorfer, Mike Roberts
Link on TechEd NA 2014 Channel 9 Recording: DCIM-B363 Automated Service Requests with Microsoft System Center 2012 R2
And finally - As always, for more information, tips/tricks, and example solutions for Automation within System Center, Windows Azure Pack, Windows Azure, etc., be sure to check out the other blog posts from Building Clouds in the Automation Track (and http://aka.ms/IntroToSMA), the great work over at the System Center Orchestrator Engineering Blog, and of course, Ryan’s Blog over at http://opalis.wordpress.com!
Getting an interesting error when trying to use my on premise TFS server. See here:
Multiple ambiguous overloads found for GetTeamProjectCollection. Is this something to do with how I'm supplying my TFS server in the deploy config? Default TFS setup has it on port 8080-could this be messing it up?
What is the TFS version you are using? What are you supplying for the following variables in your configuration files
are the variables and runbooks successfully imported into your environment or not?
Latest version of TFS. I was able to get this working, following some adjustments on the TFS server, also had errors connecting to the SMA server because of ssl errors (fixed that by using fqdn).
That being said, regarding the Monitoring runbook - how long should that take to run; it seems to be taking quite a while. No errors produced (yet).
I'm trying to get this set up and I am getting this error every 30 seconds:
At Monitor-TFSWorkspaceChanges:178 char:178
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Any ideas where to start troubleshooting?
The monitor runbook will be running consistently in your environment, it always is looking for new publishes from TFS
We troubleshot this together, your error was related to visual studio online :-). Try using team explorer 2013 or on prem TFS