Windows Azure Service Management

10/29/2010 7:45:00 PM
Unlike on-premise applications, the deployment of a cloud services involves only software provisioning from the developer's perspective. You saw in the earlier examples how hardware provisioning was abstracted from you in the deployment process. In a scalable environment where enterprises may need to provision multiple services across thousands of instances, you need more programmatic control over the provision process rather than configuring services using Windows Azure developer portal. Manually uploading service packages and then starting and stopping services from the portal interface works well for smaller services, but becomes a time-consuming and error-prone process when deploying multiple large-scale services. The Windows Azure Service Management API allows you to programmatically perform most of the provisioning functions via a REST-based interface to your Windows Azure cloud account. Using the Service Management API, you can script your provisioning and deprovisioning process end to end in an automated manner. In this section, I will cover some important functions from the Service Management API and also demonstrate some source code for you to build your own cloud service provisioning process.

1. Service Management API Structure

The Service Management API provides most of the functions you can perform on the storage services and hosted services from Windows Azure developer portal. The Service Management API categorizes the API operations into three primary sections: storage accounts, hosted services, and affinity groups. Operations on storage accounts mainly cover listing of accounts and generation of the access keys. Operation on hosted services cover listing of services, deploying services, removing services, swapping between staging and production, and upgrading services. The affinity groups operations are limited to listing and getting properties of affinity groups in your account.


You can find the Service Management API reference at

The Service Management API uses X.509 client certificates for authenticating calls between the client and the server.

The source code in the following section is based on early CTP version (released October 10, 2009) of the service management API and its associated client assembly Microsoft.Samples.WindowsAzure.ServiceManagement. You can download the latest version of the assembly from the Windows Azure Code Samples page at Even though the API may change in the future, the concepts used in this section will remain the same past its final release. You may have slightly modify the source code to make it work with the latest available API.

2. Programming with the Service Management API

To start programming with the Service Management API, you must first create a valid X.509 certificate (or work with an existing one). You can use makecert.exe to create a self-signed certificate

makecert -r -pe -a sha1 -n "CN=Windows Azure Authenticat
ion Certificate" -ss My -len 2048 -sp "Microsoft Enhanced RSA and AES
Cryptographic Provider" -sy 24 proazureservicemgmt.cer

Next, go to the Accounts section of Windows Azure Developer portal and upload the certificate from Manage API certificate section.

Figure 1. Upload the API certificate

Once the certificate is uploaded, you can call the Service Management REST API by passing the certificate as the ClientCertificate property of the System.Net.HttpWebRequest object, by using the csmanage.exe application from the Service Management API samples, or by building your own application. In Ch3Solution, I have created a sample Windows Application that makes REST calls to the Service Management API. It uses the Microsoft.Samples.WindowsAzure.ServiceManagement.dll file from the service management code samples. The csmanage.exe uses the same assembly to make the API calls. Eventually, the API assembly may become part of the Windows Azure SDK. Figure 2 illustrates the Service Management API windows application.

Figure 2. The Service Management API windows application

In Figure 2, The Service Management Operations section lists the operations that you can invoke on the Service Management API. The output textbox prints the output from the operations. The right-hand side of the user interface consists of input parameters. The input parameters are as follows:

  • Subscription Id: You can get the subscriptionId from the Account page of the developer portal. This parameter is required by all the Service Management API operations.

  • Certificate Path: This text box points to the API certificate file on the local machine. This certificate must match the one you uploaded to the portal.

  • Resource Type: This drop-down lists the types of resource you want to access: Hosted Service, Storage Account, or Affinity Group.

  • Resource name: You should type the name of the resource you want to access (e.g., storage account name, hosted service name, affinity group name).

The remaining input parameters are operation dependant. You can choose an operation from the Service Management operations list, enter input parameters and click Execute Operation. For example, to create a deployment in your hosted service account, you can:

  1. Select the Create Deployment operation.

  2. Enter your Account SubscriptionId.

  3. Select the API certificate from local machine.

  4. Select Hosted Service Name as the Resource Type.

  5. Enter the name of the Hosted Service you want to deploy your service to in the Resource Name text box.

  6. Select the slot type (staging or production).

  7. Choose a deployment name.

  8. Choose a deployment label.

  9. You have to then point to a service package (.cspkg) on a blob storage in the Package Blob URL text box.

  10. Select the path to the ServiceConfiguration.cscfg file of the cloud service.

  11. Click Execute Operation.

The OP-ID shows the operation ID returned by the method call, which you can use to track the operation status. To check the status of the deploy operation, select the Get Operation Status method, and click Execute Operation. The status gets displayed in the bottom window. Once the deployment is complete, you can run the deployment by selecting the Update Deployment Status method and selecting the "running" option from the deployment status drop-down. Similarly, you can execute other operations from the Service Management API.

Other -----------------
- Windows Azure : Content Delivery Network
- Windows Azure Storage Services
- Windows Azure Storage Characteristics
- Microsoft Windows Vista : Using Parental Controls to Restrict Computer Usage
- Microsoft Windows Vista : Creating and Enforcing Bulletproof Passwords
- Windows 7 Customization : Taking Ownership of Your Files
- Windows 7 Customization : Stopping Delete Confirmations
- Windows 7 : Managing a User Account - Limiting Computer Access
- Windows 7 : Managing a User Account
- Windows 7 : Understanding User Accounts and Permissions
- Windows Azure : Diagnostics
- Windows Azure : Common Storage Tasks - Utilizing Concurrent Updates
- Windows Azure : Common Storage Tasks - Modeling Data
- Windows Azure : Exploring Full-Text Search (part 3)
- Windows Azure : Exploring Full-Text Search (part 2) - Building an FTS Engine on Azure
- Windows Azure : Exploring Full-Text Search (part 1) - Indexing
- Windows Azure: Building a Secure Backup System (part 6) - Uploading Efficiently Using Blocks
- Windows Azure: Building a Secure Backup System (part 5)
- Windows Azure: Building a Secure Backup System (part 4)
- Windows Azure: Building a Secure Backup System (part 3)
Most View
- Microsoft XNA Game Studio 3.0 : Adding Bread to Your Game (part 2) - Improving Programs Using Methods, Handling Collisions
- Overview of Process Management in Microsoft Visio 2010 (part 3) - Validation of process diagrams
- Windows Phone 7: Posting to Facebook or Windows Live
- Mobile Handheld Devices : DATA SYNCHRONIZATION
- Exchange Server 2010 : Deploying Unified Messaging (part 1)
- Certificate-Based Encryption
- CSS for Mobile Browsers : CSS Sprites
- Programming Windows Phone 7 : An XNA Program for the Phone (part 1)
- DirectX 10 Game Programming : Shaders and Effects - High Level Shading Language
- Windows 7: Troubleshooting Device Problems (part 2) - Displaying a List of Nonworking Devices
Top 10
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 3) - Configuring Recipient Filtering
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 2)
- Implementing Edge Services for an Exchange Server 2007 Environment : Utilizing the Basic Sender and Recipient Connection Filters (part 1)
- Implementing Edge Services for an Exchange Server 2007 Environment : Installing and Configuring the Edge Transport Server Components
- What's New in SharePoint 2013 (part 7) - BCS
- What's New in SharePoint 2013 (part 6) - SEARCH
- What's New in SharePoint 2013 (part 6) - WEB CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 5) - ENTERPRISE CONTENT MANAGEMENT
- What's New in SharePoint 2013 (part 4) - WORKFLOWS
- What's New in SharePoint 2013 (part 3) - REMOTE EVENTS