After all of the previous blog posts, I thought that I would climax with a
few real examples of using the DSC resource for XenDesktop.
Earlier this year (just a few++ weeks ago) Microsoft released the VM
extensions for Virtual Machines. This is the IaaS style VM role. The VM
Extensions are small modules that you can inject into your VM and you can
interface with them. The simplest way to think of it is they are purpose built
agents. You can configure them on provisioning, but also nifty is that you can
update the configuration of an extension after deployment and do something
else.
There is a script extension that can be used to download and execute any
script(s) inside of your VM. Handy for performing a number of things. You can
use this to drive DSC if you like.
After that the DSC extension was released. This one is purpose built just
for DSC and the one this post will be focusing on.
I will warn you, I am going to expose a few warts of the process as I do
this, just because the extension is built to support DSC and only the DSC
packages. And this process requires external media - yes, the media could be
bundled into the DSC resource (the only workaround to this process at the
moment), but that would make the resource really fat. So, why not continue to
think of it as two problems.
One thing - the DSC provider for XenDesktop expects media to be on the
machine where it runs or a DVD attached ISO. So a ZIP or ISO (DVD attached or
downloaded to the machine) or folder. This way there is no requirement to save
credentials for connecting to some share or other store.
Now, let get everything set up. (I am experimenting with a slightly
different writing format here, so you will have to let me know if it works for
you)
First of all, I am going to assume that you are sitting at your
'configuration computer' - that management computer that you use that has all of
the consoles and what not installed. In this case it is where you build all of
your configurations that you later push to machines or place on your pull
server. Your configuration computer needs the XenDesktop
resource module installed under the path
"%ProgramFiles%\WindowsPowerShell\Modules" so a later cmdlet for the DSC script
provider can automagically pick it up and bundle it for you.
Begin by connecting to your Azure subscription
and set the storage account you will be using (
Set-AzureStorageAccount -StorageAccountName "YourCoolStorageAccount" )
Then upload the XenDesktop media. ( the media is created
from the ISO, simply ZIP the contents of the ISO - don't add any folders into
the path)
Be sure that your container security is set to public blob (not public
container) since we don't want folks discovering it.
For a later step
you will need the URI to the blob that you just uploaded.
Now, we need to define
the configuration (the DSC one) that will be applied to the VM.
For that I created a PowerShell script that accepts two
parameters; the URI to the media and the role to be installed.
The DSC extension will run this and then apply the configuration.
Now that the
configuration script exists, this must be packaged up, with the
module, for the Azure DSC extension to use. I saved mine with the name
"XenDesktopInAzure.ps1".
The Azure PowerShell cmdlets have created a cmdlet just for this action;
Publish-AzureVMDscConfiguration
After
running the Publish-AzureVMDscConfiguration cmdlet, go check out your Azure
management portal and look into the container and you will find a ZIP archive
with a name that matches your script. What the Public- command does is package
the script and the modules that are used into the ZIP, then uploads them to
Azure for you.
Now, define the VM, so that can be created.
First needed is an Azure VM Image - an 'image' is a virtual
disk that is installed with an OS and prepared with sysprep and registered with
Azure as an image - to the management platform, this means that it can
specialize the OS on provisioning through mini-setup and the use of an
unattended answer file.
Moving forward to
the next step of building the VM configuration.
First, begin with a base VM configuration.
Then add the provisioning configuration ( these are the specialization
settings ).
Then configure the Azure DSC VM extension.
Then
create the VM. Azure and the VM extension take care of
processing the configuration script, and the configuration script downloads the
ZIP, unpacks it, and installs the role.
One really cool
thing about DSC is that you can keep applying configurations. The last applied
settings to a specific thing win, configurations are not undone when a new one
is added, simply the changes defined in the new configuration are applied. So,
if you have some management layer, it can apply configuration after
configuration if it so wanted to, or change a configuration over time to modify
something.
As an option for delivering media, you can use a data disk with the
XenDesktop media within it. Then you can attach that to a new VM and have DSC
mount the disk (rather, make sure it is mounted at a specific drive letter) and
then perform the installation.
If you are using SCVMM, you can have an ISO attached to the VM as part of the
template. You could even use DSC to map a drive if that is what fits for your
environment. They are all possibilities.
Have fun! And please, send feedback!
Working with the "back-end" of I.T. systems. Learn. Apply. Repeat.
The things learned as an IT Pro'fessional turned software tester, researcher, and product manager.
Wednesday, October 8, 2014
Monday, October 6, 2014
Using the XenDesktop DSC resource
In my last article I covered using the built-in desired
state configuration (DSC) resources to stand up a Citrix License server.
All but one of the resources I used shipped in the box with Server 2012 R2 - and
you could argue that I really didn't have to use the custom resource to fetch
and install my license file.
I used the package resource to install the Citrix License server.
The package resource works great for the License Server, which is a really quick and simple install. But what do you do when you have an installer that requires reboots mid-stream? Or even multiple reboots?
Some of you who have installed XenApp or XenDesktop over the years know that this takes extra time and you have to follow your checklist or the wizard to make sure you didn't miss a step. What if you didn't need to do that? Or what if we could greatly simplify the entire process?
Here is an example I think you will like.
Recently released is a Technology Preview of a desired state configuration resource for XenDesktop. You can find it here: http://www.citrix.com/go/xendesktop-for-the-private-cloud.html
Follow the admin guide and place the module in the PowerShell path on your target (and the machine where you create configurations) and move forward.
Since I will be using this in upcoming examples, lets give it a quick description.
This brings together a few of the previous articles.
Lines 9 - 12 coupled with line 47 sets the local configuration manager (LCM) to handle reboots on its own.
Lines 15 - 20 creates my unzip and logging path
Lines 24 - 30 unzips my media. I know what the name of my media is and I expect that media to be delivered to the same path where this script is being run by some other agent or process - such as an external process that downloads the media plus this script to the same path and then runs this script.
Lines 33 - 38 call the XenDesktop resource and install one of the roles defined.
If the role installation sets that the system requires a reboot, the LCM handles that. On reboot it processes the configuration again, until the XenDesktop resource returns 'true' for ensure being set to 'present'.
For the Controller this is generally one reboot, for a session host or VDA tis could be two reboots. The great thing for me is that it is totally hands off. DevOps in the XenDesktop world.
Personally, I hope that you check this out, and I am looking for feedback on where this needs to go next and if it is useful to you. So please, speak up in comments, in the forum, or complete the survey.
Next - lets show this all in action in some real use cases.
I used the package resource to install the Citrix License server.
The package resource works great for the License Server, which is a really quick and simple install. But what do you do when you have an installer that requires reboots mid-stream? Or even multiple reboots?
Some of you who have installed XenApp or XenDesktop over the years know that this takes extra time and you have to follow your checklist or the wizard to make sure you didn't miss a step. What if you didn't need to do that? Or what if we could greatly simplify the entire process?
Here is an example I think you will like.
Recently released is a Technology Preview of a desired state configuration resource for XenDesktop. You can find it here: http://www.citrix.com/go/xendesktop-for-the-private-cloud.html
Follow the admin guide and place the module in the PowerShell path on your target (and the machine where you create configurations) and move forward.
Since I will be using this in upcoming examples, lets give it a quick description.
This brings together a few of the previous articles.
Lines 9 - 12 coupled with line 47 sets the local configuration manager (LCM) to handle reboots on its own.
Lines 15 - 20 creates my unzip and logging path
Lines 24 - 30 unzips my media. I know what the name of my media is and I expect that media to be delivered to the same path where this script is being run by some other agent or process - such as an external process that downloads the media plus this script to the same path and then runs this script.
Lines 33 - 38 call the XenDesktop resource and install one of the roles defined.
If the role installation sets that the system requires a reboot, the LCM handles that. On reboot it processes the configuration again, until the XenDesktop resource returns 'true' for ensure being set to 'present'.
For the Controller this is generally one reboot, for a session host or VDA tis could be two reboots. The great thing for me is that it is totally hands off. DevOps in the XenDesktop world.
Personally, I hope that you check this out, and I am looking for feedback on where this needs to go next and if it is useful to you. So please, speak up in comments, in the forum, or complete the survey.
Next - lets show this all in action in some real use cases.
Subscribe to:
Posts (Atom)