Introducing Lync Service Templates

If you have been following the teams blog series on Service Templates you may have already come to the conclusion that the only one missing in the Microsoft productivity suite is Lync!


Our goal as we began to build out this series of templates was to provide an automated way to stand up these core productivity components allowing you to quickly build out dev/test and tenant environments either in a standalone manner or with all of the core Office Server components together. The first deliverable for Lync is a Lync Standard Server deployment that automates the creation and configuration of the Lync 2013 Server thus completing the SharePoint/Exchange/Lync trio.

Lync Server 2013 Service Templates for Virtual Machine Manager


Before we get started, if you are new to service templates

Our team has published a number of reference posts that go in to great detail on how to import and configure a service template in System Center Virtual Machine Manager.  It would be redundant to publish this again.  If this topic is new to you I definitely recommend you peruse the content below to get an understanding of how the information below is applied in a more “step by step” walkthrough.

Application Management – Service Templates, real reusable examples

(SharePoint) Application Management – Example – Deploying a Service to Your Private Cloud

(Active Directory) Application Management – Service Template – Active Directory (STAD)

(Exchange) Exchange Server 2013 CU2 Service Templates for Virtual Machine Manager

(SQL) SQL Server Self-Service Kit: Provisioning SQL Server as Service with the System Center stack

(Oracle) Oracle Self-Service Kit: Provisioning Oracle Database components using the System Center stack


We focused on a Lync Server 2013 Standard Deployment as the methods leveraged can be used as a building block for more advanced deployments. This template demonstrates not only how to install all of the prerequisites for a Lync Server 2013 deployment but also how to use PowerShell and the Lync bootstrapper to configure and deploy Lync in an automated and repeatable process. There are a number of references that will help you with the requirements for Lync Server 2013, the different deployment types and best practices when leveraging virtualization. These are reference below for your convenience.

Lync Server 2013 Prerequisites

Running Lync Server in Virtual Environments

Server Collocation in a Standard Edition Server Deployment

Lync Server 2013 Reference Topologies


Now that we have the background let’s move on to how you can use the template to deploy your own Lync 2013 Standard Edition Server. First the requirements and assumptions for the template.


Active Directory - Lync needs Active Directory and it is assumed that you already have AD deployed, if not go grab the AD Service Template and give it a whirl!

Application Management - Service Template – Active Directory (STAD)

Value add!  If you would like to add on a Post-Install script for the AD service template, you would only need to issue the following two lines of PowerShell using a valid RunAs account.

001 002 Add-WindowsFeature Adcs-Cert-Authority -IncludeManagementTools Install-AdcsCertificationAuthority -CAType EnterpriseRootCA -Confirm:$false


Certificate Authority - Next we assume that the Active Directory environment in question has an Enterprise Certificate Authority installed that can be leverage during the Lync install to request certificates.

Schema Extensions - We also require that the AD schema be updated to support Lync.  As described in the details of the Exchange service template, if you plan to automatically let this occur during deployment then the runas account that you launch the template under needs to have these rights.

Virtual Machine Template for Windows Server 2012 RTM – You will need a VHD file containing a template for the base OS.  For the purpose of this blog post we are assuming Windows Server 2012 RTM (not R2).

Blank VHD – The service template utilizes a blank VHD for the Lync server data disk.  You will need to create a fixed size VHD, format it, and include it in your VMM library.

Accounts – You will need an account setup as a VMM RunAs configuration that has local administrator permissions within the VM and also permissions in Active Directory to perform schema extensions unless you will handle those in advance, separately from the service template.

You might be interested in automating creation and usage of RunAs accounts per tenant.  If so, check out this great article from Charles Joy!

Automation–PowerShell Workflow Script Spotlight–Creation and Parameterization of Virtual Machine Manager Run As Accounts for “OnBehalfOf” Service Template Deployment

Custom Resources

Now that we have those out of the way we need to build out the Virtual Machine Manager custom resource required to install Lync Server 2013.  A custom resource is simply a folder in the VMM Library that stages file based resources (aka files and folders) that can be mapped to an application in a service template to provide installation source.  You create a folder structure and give the root level folder a special designation by ending it in “.CR” then import it in to the library.  For more information review the TechNet article below.

How to Import and Export Physical Resources To and From the Library

We can consolidate all prerequisite install files and the Lync install files in to a single folder structure.  The contents are as follows:

Lync Server 2013 installation source - The full Lync Server 2013 Standard Edition folder structure from your Lync install ISO. It needs to be put in a folder at the root and named “Lync Server 2013”

Silverlight x64 – Create another folder at the root titled “prereqs” and copy in the latest 64-bit Silverlight installer.

     Microsoft Silverlight

Default Topology File - The DefaultTopology.xml file that is in the download zip for this solution.  Just copy this file in to the root folder.

Installation Script - The Lync_install.ps1 that is also in the download zip for this solution.  This should also be copied to the root folder.

The first two are self-explanatory being the install source for Lync and the install for Silverlight needed for the Lync management console. The last two are a bit more interesting.

The DefaultTopology.xml is a base Lync Topology that will be dynamically updated based on information from the environment we are deploying Lync into. You could provide this other ways like requiring that the topology builder is run and the topology you want to deploy is already in AD but we wanted to give you an end to end solution so we created a default base topology and edit during the deployment process and upload it into AD.

Next there is the lync_install.ps1. This is the workhorse of the solution. It launches the various Lync PowerShell commands as well as additional AD and base OS PowerShell commands to configure the server and directory for the deployment of Lync. It calls the Lync bootstrapper.exe program with the various switches and at the right times to ensure that the Lync install moves along. This entire script is basically automating and calling the same PowerShell commands as the Lync Deployment Wizard to deploy a standard edition of Lync including automating the retrieval of certificates and assignment. Once the script completes you have a functioning Lync 2013 Standard Edition Server.


Even though we are not going to walk through every task required in setting up the service templates, I want to make sure you have all the information you need if this is your first go-around.  You absolutely should take the time to look over the blog posts linked at the top, as they go in to great detail.  You can also review the official documentation below.

Creating and Deploying Services in VMM

Start by copying the files in to place and importing them in to VMM.  Note in the screenshot below, the .CR file has been created.  This will happen automatically after VMM has fully discovered the folder and is an indication that it is ready for use.


Next you will need to import the service template you downloaded from the TechNet gallery (see the blue Download button at the top).  During import, make sure you select the custom resource you created.


Click through the properties of the template by right clicking on it after import and selecting Open Designer.  Then right click on the center box and select Properties.  You will find the common parameters are in use such as Network, the Domain to join, which RunAs account to use, etc.  You can identify them by the @ symbols before and after the name.

You will need to enter some required values.  Specifically, click on OS Configuration and provide the password for the local Administrator account that will be used inside the VM, and a product key.

You will find the applications to be fully configured and pointing to the Custom Resource you created.


Finally, when you have completed the configuration, choose Save and Validate and then Configure Deployment.  Give your deployment a name and select the virtual network that the VM’s should use for communication (a network where your test domain exists).  On the resulting page, populate the parameter values for Domain and select the RunAs account.


Finally, click on Deploy Service and review the job in VMM for completion!

Post-Install (manual) Tasks

There are a few things that are left for post configuration and they include the following:

1) The friendly URLs are not completely defined. You can launch the topology builder post install and update these and republish the topology.


2) We did not install a WAC server or an Edge Server. These can be added to the topology and automated as well. Maybe we will cover this in a subsequent template/post!

3) We collocated the File Share server and the Mediation Server on the same box as the Lync Server and you may want to separate these depending on your deployment.

4) We did not integrate this in with Exchange from a UM or OWA IM perspective. This exercise is left to the reader.  Smile


Hopefully this sample gives you a great base to build from. The same techniques could be used to build out a full Lync Enterprise Topology or a more robust Lync Standard edition deployment that is integrated with Exchange. That said, it does make standing up Lync 2013 especially for Dev/Test very quick and we hope you find it useful!

Stay tuned to Building Clouds!