In a previous post, I started to talk about using Azure for training environments. At Hitachi, we have been using Azure to host AX training for clients. It has been going pretty well and I have been working on an internal script that we use to help deploy the training environment.
During a recent podcast I caught on to Desired Service Configuration (DSC) for PowerShell. Released last year, DSC is a management platform that "enables deploying and managing configuration data for software services and managing the environment in which these services run." Sounds pretty neat!
You can read more about DSC here. The base modules that come with DSC are pretty good. They get the job done. Please note that you will have to install WMF 4.0 to get any functionality. In any event, what is really exciting is the modules that are currently in "experimental" mode, which are due for release with WMF 5.0.
You can see what is currently underway here.
There are some pretty handy modules in there, including one to manage Azure deployments. Many times in my own lab, I have blown away everything and started again. It will be nice to finally have a script that I can use to quickly rebuild a base configuration.
So here we go.
First thing, you will want to have windows 8 or better. With WMF 5.0 still in preview, there is no support for the older operating systems. This took most of my time as I had to download a Windows 8 image to play around with.
Once you have your windows 8 image configured (Install WMF 5.0 with the link above, Install Azure Powershell, etc), you can head to DSC Resource Kit to download the latest zip. The install instructions are fairly easy, you just have to unzip into the modules directory (generally c:\program files\windowspowershell\modules).
This module is written a little bit differently then the other ones. Basically, instead of calling out to various nodes, you call localhost with the azure configuration. This then runs what you have configured.
One note is that you will have to allow WinRM to run. An easy way to configure this is to run
winrm quickconfig
from an elevated powershell command line. Please note that I tried running this from the ISE command window only to have it fail to complete. From reading through the options, it basically enables the service to run, and creates an exception in the firewall allowing WinRM connections. There are probably some security considerations to be had when running the quickconfig, but I'm just running this on my local, so .....
DSC supports a separation of intent and configuration, which is a nice touch. You can create a configuration element that is generic in nature (create storage account, etc) and then combine it with configuration that is user/task specific.
The DSC Resource Kit contains a ton of example code that you can filter through. Mine is very similar to the xAzure example for creating a VM in the cloud.
As usual, you can grab a copy of my script in github.
As this technology continues to advance, I could see how you would be able to create a script that fully deploys an environment (AD, SQL, WebServer, etc). Furthermore, you can use a central server to control all deployments and prevent drift.
Have fun!
Monday, October 20, 2014
Wednesday, August 20, 2014
Using Azure for Training Environments
Many clients are starting to look at cloud providers such as Azure to host dev/test/training environments. The pros for this are easy to see. Spin up as many resources as you need, for only the duration that you require, and pay for it as OpEx rather than CapEx.
One good candidate for this type of operation is dynamics AX. Generally, during any sales/deploy cycle you will fire up many AX vms to show off functionality or train users. While you can do all of this manually via the management portal, it would be nice to develop an automated way to spin up/down environments to suit your needs.
For the purpose of this post, I am trying to build a set of scripts that will provision AX environments as needed. These AX environments will be self contained units that only have external access enabled, and cannot talk to each other.
Step 1: Get an Image
For partners, Microsoft releases a single-box demo that can be used to show off the features of AX. This is the image that I want to use. One way would be to download the image from partner source and then upload it to your Azure subscription following the instructions here. Originally, I started down this path. I didn't want to use my personal internet connection (it would have been super slow), so I actually fired up a VM inside of Azure and started downloading. On the plus side, I was getting 14000 KB/s transfer rate. On the con side, one of my coworkers suggested I use LCS only after I had finished the download.
Ultimately, I want to be able to spin up/down environments via automation of some kind. LCS was good for the initial deploy, but I wanted to take it a step further. I ended up capturing the disk after it was deployed and then using that as my base image.
One important point to note about the AX demo is that it has AD built in. When you deploy the VM, however, unless you explicitly set the DNS settings to 127.0.0.1, you will get a public DNS that won't know how to route for contoso.com (or it will, but not to you).
Step 2: Build a Provisioning Script
When building out a training environment, you will need to provision VMs according to your needs. In my case, I decided to build a script that could scale up and down my environment as I needed. Basically, I could pass in to the script the number of VMs that I would require. Say I wanted 20, and already had 10 built. It would simply provision 10 more VMs. Say I wanted to deprovision everything. I could simply state that I wanted 0 VMs and the script would remove all the VMs currently loaded.
This is probably overkill for what one would need. You could write a script that simply destroyed all the VMs with a given prefix in a given service and then recreate the exact number you wanted. Oh well...
Some solution notes:
Step 3: Manage the state of the provisioned VMs
As shown in a previous post, you can build scripts inside of Azure Automation to start up and shut down your lab as needed. You can schedule this, or run it manually via command line for an on-demand type experience.
Of course this idea can scale to any type of training environment. That is the beauty of code!
One good candidate for this type of operation is dynamics AX. Generally, during any sales/deploy cycle you will fire up many AX vms to show off functionality or train users. While you can do all of this manually via the management portal, it would be nice to develop an automated way to spin up/down environments to suit your needs.
For the purpose of this post, I am trying to build a set of scripts that will provision AX environments as needed. These AX environments will be self contained units that only have external access enabled, and cannot talk to each other.
Step 1: Get an Image
For partners, Microsoft releases a single-box demo that can be used to show off the features of AX. This is the image that I want to use. One way would be to download the image from partner source and then upload it to your Azure subscription following the instructions here. Originally, I started down this path. I didn't want to use my personal internet connection (it would have been super slow), so I actually fired up a VM inside of Azure and started downloading. On the plus side, I was getting 14000 KB/s transfer rate. On the con side, one of my coworkers suggested I use LCS only after I had finished the download.
Ultimately, I want to be able to spin up/down environments via automation of some kind. LCS was good for the initial deploy, but I wanted to take it a step further. I ended up capturing the disk after it was deployed and then using that as my base image.
One important point to note about the AX demo is that it has AD built in. When you deploy the VM, however, unless you explicitly set the DNS settings to 127.0.0.1, you will get a public DNS that won't know how to route for contoso.com (or it will, but not to you).
Step 2: Build a Provisioning Script
When building out a training environment, you will need to provision VMs according to your needs. In my case, I decided to build a script that could scale up and down my environment as I needed. Basically, I could pass in to the script the number of VMs that I would require. Say I wanted 20, and already had 10 built. It would simply provision 10 more VMs. Say I wanted to deprovision everything. I could simply state that I wanted 0 VMs and the script would remove all the VMs currently loaded.
This is probably overkill for what one would need. You could write a script that simply destroyed all the VMs with a given prefix in a given service and then recreate the exact number you wanted. Oh well...
Some solution notes:
- Script relies on VMs being prefixed with a particular string that identifies them as AX training VMs
- Script assumes that you have already loaded an image file and have the name for that image handy
- Script attempts to set the DNS for the servers to 127.0.0.1
- Script is NOT production ready. There are some bugs (which you will probably notice if you use it) so use it as a conceptual reference only
Step 3: Manage the state of the provisioned VMs
As shown in a previous post, you can build scripts inside of Azure Automation to start up and shut down your lab as needed. You can schedule this, or run it manually via command line for an on-demand type experience.
Of course this idea can scale to any type of training environment. That is the beauty of code!
Friday, July 11, 2014
First crack at Azure Automation
Managing resources in the cloud seems to be the new frontier for the traditional IT departments within companies. We often talk about how we can make this easier for companies to do.
In my case, I have a small lab within Azure. What I want to be able to do is launch all the services in my lab on demand. After all, that is the real cost savings of moving to a platform like Azure. Spin up the servers when needed, use them, de-allocate them at the end of the day to save money. Small labs could be managed easily via the management console, but I needed a reason to try Azure Automation. Note that Azure Automation, at time of writing, is in preview mode and you need to request it on your subscription.
First things first, have a read at the official docs.
Step-By-Step Azure Automation
Runbook Management
At a high level, Azure Automation is built to run powershell-workflow scripts. Perfect fit if you don't want to run your own system center components, or other automation tools. You get charged by the hour an automation script is running.
Azure Automation makes use of "Automation Assets" in order to run. Basically, you can create connections and credentials and then, via powershell, use them to connect to an Azure subscription. Assets are also used to load modules into your powershell environment in the cloud, set variables that you can use globally, and also create schedules that you can then apply to runbooks or groups of runbooks.
At the outset, it seems to have all the basics for you to create a rich set of automation tools to help you manage your Azure subscription(s). It even provides an online editor with intellisense to help you create your scripts.
The Step-By-Step details some powershell scripts that you can use to connect to an azure subscription and stop a demo. I implemented essentially the same thing. You can find my code on GitHub. I hope to add more scripts as I move along.
In my case, I have a small lab within Azure. What I want to be able to do is launch all the services in my lab on demand. After all, that is the real cost savings of moving to a platform like Azure. Spin up the servers when needed, use them, de-allocate them at the end of the day to save money. Small labs could be managed easily via the management console, but I needed a reason to try Azure Automation. Note that Azure Automation, at time of writing, is in preview mode and you need to request it on your subscription.
First things first, have a read at the official docs.
Step-By-Step Azure Automation
Runbook Management
At a high level, Azure Automation is built to run powershell-workflow scripts. Perfect fit if you don't want to run your own system center components, or other automation tools. You get charged by the hour an automation script is running.
Azure Automation makes use of "Automation Assets" in order to run. Basically, you can create connections and credentials and then, via powershell, use them to connect to an Azure subscription. Assets are also used to load modules into your powershell environment in the cloud, set variables that you can use globally, and also create schedules that you can then apply to runbooks or groups of runbooks.
At the outset, it seems to have all the basics for you to create a rich set of automation tools to help you manage your Azure subscription(s). It even provides an online editor with intellisense to help you create your scripts.
The Step-By-Step details some powershell scripts that you can use to connect to an azure subscription and stop a demo. I implemented essentially the same thing. You can find my code on GitHub. I hope to add more scripts as I move along.
Subscribe to:
Posts (Atom)