A Walk Through of a Windows Azure Data Center

Note: This is by no means anything new, but I’ve been referring a lot of people to it lately so I thought that I should share it with my readership on my blog. The Following video was recorded by Scott Hanselman at PDC09.

Have you ever wondered what a Windows Azure Data Container looked like? Perhaps you’ve been curious how Microsoft keeps their services cool in these vast shipping containers we all know an love as the Windows Azure Cloud.

Patrick Yantz a Cloud Architect from Data Center Services at Microsoft gives follow Program Manager Scott Hanselman a tour of a Proof of Concept (PoC) Data Center.

A Tour of a Cloud

The video is about 16 minutes long and provides a lot of information about the Technologies Microsoft Leveraged to create their Data Centers.

Building a Cloud

Microsoft has released another video that shows how the Data Containers are built. Just incase you’re curious, here is the video that shows the production of a Windows Azure G4 Data Container.

Get Microsoft Silverlight

The video is about 3 minutes in length.

Happy Clouding!

Running PowerShell Scripts in Windows Azure Start-up Tasks

With the release of the Windows Azure SDK 1.3, Microsoft introduced Startup tasks to Windows Azure Service Definition files.

Startup Tasks XML Schema

Start-up tasks are configured using XML in the Cloud Service Definition file (.csdef) using the Startup and Task Element. Here is the Startup Element for my particular Cloud Service Definition file.

<Startup>
<Task commandLine="PowerShellScriptLauncher.cmd" executionContext="elevated" taskType="simple" />
</Startup>

Anatomy of the PowerShell Script Launcher

The best implementation of Startup Tasks would be to create a library of common tasks that are reusable. You can pass arguments into a PowerShell Script to provide specific details required for an individual deployment.

Enabling PowerShell Execution in Windows Azure

PowerShell is installed by default on Windows Azure, however ExecutionPolicy does not allow unsigned scripts to be run by default. In order for our PowerShell scripts to be executed it is necessary to change the ExecutionPolicy to allow RemoteSigned Scripts.

Windows Azure has two different Versions of Windows (Server 2008 SP1 & Server 2008 R2) which can be controlled by setting the osFamily and osVersion.

Changing PowerShell ExecutionPolicy on Server 2008 SP1

Server 2008 SP1 is considered osFamily 1 on Windows Azure.

PowerShell 1.0 didn’t support the Set-ExecutionPolicy command [which was introduced in PowerShell 2.0]. In order to get around this I’ve created a registry file which makes the ExecutionPolicy change in the Registry. Create a file “ExecutionPolicy.reg” and include:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds Microsoft.PowerShell] "ExecutionPolicy"="RemoteSigned"

Changing PowerShell ExecutionPolicy on Server 2008 R2

Server 2008 R2 is considered osFamily 2 on Windows Azure.

Server 2008 R2 is running PowerShell 2.0, so executing a Set-ExecutionPolicy command is possible. Create a file “ExecutionPolicy.ps1” and include:

Set-ExecutionPolicy RemoteSigned -Force

Now that you have created a way of executing PowerShell on Windows Azure you need to add the appropriate method to the Startup Task Script. Add the appropriate line below to your PowerShellLauncher.cmd file:

REM This is for Server 2008 SP1
ExecutionPolicy.reg

REM This is for Server 2008 R2
powershell.exe ExecutionPolicy.ps1

Now you can execute full featured PowerShell commands to get your instances up to a Running State.

Great Resources