The Orchestrator team recently released the Beta Windows Azure Integration Pack for Orchestrator in System Center 2012 SP1.

This Integration Pack is full of activities to throw at Windows Azure and manage the following configuration items of your Windows Azure subscription:

  • Certificates
  • Deployments
  • Cloud Services formally known as Hosted Services
  • Storage
  • Azure Virtual Machine Disks
  • Azure Virtual Machine Images
  • Azure Virtual Machines

 Azure IP Activities

The Orchestrator team did something really cool for this Integration Pack, for each of the configuration items listed above you have sub activities to essentially do things like create, delete, update and list.  This makes it very easy for the Runbook Designer to navigate round the UI and put your hand to tasks a lot quicker! I hope we see more and more of this practise.

The purpose of this post is to walk through deployment of a new Application using Orchestrator.  This comes in useful if your change window is out of hours but you’d rather be at home watching Dallas than sitting at your computer waiting the change window to deploy your new application to Azure.

The high level steps are:

Prerequisites: Prepare the environment

 

 

Prerequisites: Get .cspkg and .cscfg files

  1. Create a new Cloud Service
  2. Upload Package to Blob Storage
  3. Deploy the Application from the Blob

 

 

Prerequisites: Prepare the Environment

 Download and deploy the Integration Pack

Read the documentation: http://technet.microsoft.com/en-us/library/jj721956.aspx

 Then create a connection to your Windows Azure subscription.  This is done the same way as we create connections to many other targets technologies like OpsMgr, ConfigMgr, VMM and so on.

 

  1. In the Runbook Designer, click Options, and then click Windows Azure. The Windows Azure dialog box appears.
  2. On the Configurations tab, click Add to begin the connection setup. The Add Configuration dialog box appears.
  3. In the Name box, enter a name for the connection. This could be the name of the Windows Azure subscription, or a descriptive name to differentiate the type of connection.
  4. In the Type box, click the button and select a connection type.
  5. In the Subscription ID box, enter the subscription ID of the Windows Azure subscription to connect to.
  6. In the PFX File Path box, click the button and select the management certificate file associated with this Windows Azure subscription. Note: Your certificate file enables authentication of requests to your Windows Azure subscription, and so should be stored in a non-public folder to prevent unauthorized access.
  7. In the PFX File Password box, enter the password of the management certificate file associated with this Windows Azure subscription.
  8. Click OK to close the configuration dialog box, and then click Finish.

You also need to collect some pieces of information:

  • Cloud Service Name is the child domain name to register the application against. E.G. MyAppName. Full FQDN will be MyAppName.cloudapp.net
  • Storage Account Name is the storage account the application will be uploaded to and deployed from.
    • Note: This is agnostic of any Storage Account Name (Storage Service) the application, itself, is written to use.
  • Location of Package is the file location of the MyAppName.cspkg and ServiceConfiguration.cscfg files that Visual Studio creates. 

 

  •  GuestBook.cspkg is my packaged application from generated by Visual Studio
  • ServiceConfiguration.cscfg file sets values for the configuration settings defined in the service definition file and specifies the number of instances to run for each role.

Note: Applications themselves can reference storage accounts to store information that needs to be persisted, e.g. diagnostics or use Queues bound to storage accounts.  When the application is packaged this information must be known as there’s a key associated with a storage account name.  That Storage Account must be created and its associated key retrieved prior to packaging.  Below is an example of my serviceconfiguration.cscfg file.  It’s possible to manipulate those values but we’ll leave that for another post.

 

1.     Create a new Cloud Service

 

  • Initialize Data Activity | Intialize Data
    • Input parameters:
      • ServiceName
      • StorageServiceName.
      • Azure Cloud Services Activity | Create Cloud Service
        • Choose an Activity: Create Cloud Service
        • Service DNS Prefix: {ServiceName from “Initialize Data”}
        • Label: {ServiceName from “Initialize Data”} V2
        • Description: Created by Orchestrator
        • Location/Affinity Group: Location
        • Location/Affinity Group Value: North Europe

Note: Location/Affinity Group allows you to choose between the two.  It depends on the complexity of your application as to which one you choose.  For a simple application choosing a Location is fine. If you have multiple components to your application e.g. Windows Azure Application, SQL Azure Database, Storage Service and possibly some VMs, Affinity Groups are the most efficient way to enforce that all those components are located in the same datacenter.  This increases performance by making sure your services are running close to your users, appeases legal requirements to store your data in a certain country, and gives maximum business continuity to services that might be affected by severe network outages or natural disasters that could occur between datacenters.

2.     Upload Package to Blob Storage

We get storage account properties because we want to create a blob in storage to place our .cspkg of our application.

 

  • Azure Storage Activity | Get Storage Account Keys
    • Choose an Activity: Get Storage Account Keys
    • Storage Account Name: {StorageAccountName from “Initialize Data”}
    • Azure Storage Activity | CreateBlobContainer
      • Choose an Activity: Create Container
      • Storage Account Name: {Storage Account Name from “Get Storage Account Keys”}
      • Container Name: scoblob{Activity end time (minutes) from “Get Storage Account Keys”}
      • Primary Key: {Primary Key from “Get Storage Account Keys”}
      • Azure Storage Activity | Put “Service Package” Blob
        • Choose an Activity: Put Blob
        • File to Upload (File Path): {AzureDeploymentPath}\GuestBookPackage\GuestBook.cspkg
        • Storage Account Name: {Storage Account Name from “Get Storage Account Keys”}
        • Container Name: {Container Name from “CreateBlobContainer”}
        • Blob Name: GuestBookPackage
        • Primary Key: {Primary Key from “Get Storage Account Keys”}

Note: Container Name must be all lower case and I’ve just appended the end with the minute from previous activity for some uniqueness, and help with potential troubleshooting.  The container will not be needed after deployment.

3.     Deploy the Application from the Blob

 

  • Azure Deployments Activity | Azure Deployment
    • Choose an Activity: Create Deployment
    • Service DNS Prefix: {Service DNS Prefix from “Create Cloud Service”}
    • Deployment Slot: Production
    • Deployment Name: SCOGuestBook
    • Label: SCO
    • Service Configuration File Path: {AzureDeploymentPath}\GuestBookPackage\ServiceConfiguration.cscfg
    • Service Package URL: {Blob URL from “Put “Service Package” Blob”}
    • Start Deployment Immediately: True
    • Treat Warnings as Errors: True
    • Wait for Completion: True

Testing the Runbook

 

Now our Runbook has been put together, it’s time to put our Application live.

Make sure the application package is in the correct directory for Orchestrator, in my example that’s my {AzureDeploymentPath} variable.  Start the Runbook and supply ServiceName and StorageAccountName

Check the Create Azure Cloud Services acivity has completed successfully.

 

Check the Service has been created in the Azure Management Portal.

 

Check the Put “Service Pack” Blob activity has worked, from below it looks like we wrote it to the scoblob45 container

 

Check scoblob45 container and we can see the GuestBookPackage has been uploaded.

 

Check the deployment activity completes successfully.

 

Looks good in the portal…

 

The site looks good too!