The Wasabi Hands on Labs give you a good look at the basic mechanics, but I don’t find the setup too practical. Using a local console application to host the Autoscaler and rules files is probably the (IMHO) least likely architecture. Far more common would be hosting in a service on premise (if you want to have the Autoscaler local) or most likely, host it in a Azure role of it’s own. I chose to go the Azure route. First step was to get the rules.xml and the services.xml files into the cloud. I tend to be a “one step at a time” sort of guy, so running the console application with the rules sitting in a Azure hosted set of blobs seemed to be the logical first step. Here are the steps: 1) Create a container in the storage account you wish to use. Name does not matter, you will get a chance to set the container name (as well as the file names) in the app.config 2) Copy the two files from where you created them to your container. I used the same files I had locally. I made the container public to eliminate security issues, but in the final application, a bit of security needs to be applied (one problem at a time). The content type was set to text/xml. I found one reference claiming the importance of this step, and it makes sense. 3) Adjust the app.config to set the location of the files. This will let you set all the storage account and key information needed to reach into the cloud form your console application. The sections of your app.config will look like this: <rulesStores>
<add name="Blob Rules Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Rules.Configuration.BlobXmlFileRulesStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
blobContainerName="[ContainerName]" blobName="rules.xml" storageAccount="DefaultEndpointsProtocol=https;AccountName=[StorageAccount];AccountKey=[AccountKey]"
monitoringRate="00:00:30" certificateThumbprint="" certificateStoreLocation="LocalMachine"
checkCertificateValidity="false" />
</rulesStores>
<serviceInformationStores>
<add name="Blob Service Information Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceModel.Configuration.BlobXmlFileServiceInformationStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
blobContainerName="[ContainerName]" blobName="services.xml" storageAccount="DefaultEndpointsProtocol=https;AccountName=[StorageAccount];AccountKey=[AccountKey]"
monitoringRate="00:00:30" certificateThumbprint="" certificateStoreLocation="LocalMachine"
checkCertificateValidity="false" />
</serviceInformationStores>
Once I had the files up in the sky, I renamed the local copies to just to make my self feel better about the application using the correct set of rules and services.
Deploy the web role to the cloud. Once it is up and running, start the console application. You should find the application scales up and down in response to the buttons on the web site. Tune in next time for moving the hosting of the Autoscaler to a worker role, discussions on getting the logging information into diagnostics into storage, and a set of discussions about certs and how they play a role.