Before you install and use Window Azure ServiceManagement Sample you must:

  1. Review the Windows Azure ServiceManagement Sample license terms by clicking the Custom link above.
  2. Print and retain a copy of the license terms for your records.
By downloading and using the Windows Azure ServiceManagement Sample, you agree to such license terms.  If you do not accept them, do not use the software.
 

Introduction

The Windows Azure ServiceManagement sample is a command-line tool that uses the Service Management API to perform various service management tasks, such as retrieving information about a Windows Azure subscription, creating and deploying a hosted service, and updating a deployment.
For more information about the Service Management API, see About the Service Management API.

Prerequisites

To find the subscription ID and the certificate thumbprint
  1. Log on to the Windows Azure Management Portal.
  2. Click Hosted Services, Storage Accounts & CDN, and then click Management Certificates.
  3. In the Properties pane, you can find the certificate thumbprint under Thumbprint. The subscription identifier is under Subscription ID.
Build and Run the Sample
To build and run the sample
  1. Open Visual Studio 2010 as an administrator.
  2. Browse to the csmanage folder where you extracted the sample and open csmanage.sln.
  3. Open the app.config file and locate the appSetting element. Add the SubscriptionId and CertificateThumbprint key values, and then save the file.
  4. Press F6 to build the solution.
  5. Open a Command Prompt window as an administrator, and then enter the csmanage command with the needed options. For more information about the available options, see the following section.

Csmanage Options

Syntax
Windows Shell Script
Edit|Remove
csmanage /command [/resourcetype:resourcename] [optional-parameters] 
 
Informational Commands
Display help information for the csmanage application.
Windows Shell Script
Edit|Remove
/? 
 
List the properties for the specified resource (hosted service/storage account/affinity group).
Windows Shell Script
Edit|Remove
/view-properties [/resourcetype:resource] 
 
Display the status of the specified operation identifier. All API commands return an operation identifier in the x-ms-request-id header.
Windows Shell Script
Edit|Remove
/get-operation-status /op-id:<operation-id> 
 
Affinity Group Commands
List all affinity groups in the subscription. Use the view-properties option to display details on any particular affinity group.
Windows Shell Script
Edit|Remove
/list-affinity-groups 
 
Storage Account Commands
List all of the storage services that are associated with the subscription.
Windows Shell Script
Edit|Remove
/list-storage-services 
 
Display the primary and secondary keys for the storage account. You must specify the storage account resource.
Windows Shell Script
Edit|Remove
/view-keys 
 
Regenerate storage keys by using the key-type parameter to specify the key to regenerate. You must specify the storage account resource.
Windows Shell Script
Edit|Remove
/regenerate-key /key-type:primary|secondary 
 
Hosted Service Commands
Create a hosted service.
Windows Shell Script
Edit|Remove
/create-hosted-service /hosted-service:<name> /label:<label> [/description:<description>] [/affinity-group:<affinitygroupname> /location:<locationconstraintname>] 
 
List all of the hosted services that exist for the subscription. You can use the /view-properties informational command to view details about a hosted service.
Windows Shell Script
Edit|Remove
/list-hosted-services 
 
Update a hosted service.
Windows Shell Script
Edit|Remove
/update-hosted-service /hosted-service:<name> [/label:<label>] [/description:<description>] 
 
Delete a hosted service.  You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/delete-hosted-service 
 
Deployment Commands
View details about a specified deployment. You can specify the deployment either by deployment environment type or by name. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/view-deployment /slot:staging|production 
 
 
Windows Shell Script
Edit|Remove
/view-deployment /name:<deployment-name> 
 
Create a new deployment. The /package parameter must contain the URI to a .cspkg file in blob storage that is associated with the subscription. The /config parameter must specify a .cscfg file on a local drive. You must specify the hosted service resource. If /warnings-as-error is specified, warnings are returned in ErrorDetails and the operation is terminated. The deployment name must be unique.
Windows Shell Script
Edit|Remove
/create-deployment  /name:<name-of-deployment/label:<label/package:<blob-uri/config:<filename> /slot:staging|production [/warnings-as-error] 
 
Swap the deployments in between the production environment and the staging environment. If the deployment exists in both the production and staging environments, you must specify the names of both deployments. If a deployment does not exist in the production environment, the /production-slot parameter is not required. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/swap-deployment /production-slot:<deployment-name-in-production/source-deployment:<deployment-name-in-staging> 
 
Delete the specified deployment. You must specify the hosted service resource. The deployment must be in suspended state to be deleted.
Windows Shell Script
Edit|Remove
/delete-deployment /name:<deployment-name> 
 
 
Windows Shell Script
Edit|Remove
/delete-deployment /slot:production|staging 
 
Change the deployment status to ready or stopped. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/update-deployment /status:running|suspended /name:<deployment-name> 
 
 
Windows Shell Script
Edit|Remove
/update-deployment /status:running|suspended /slot:production|staging 
 
Change the configuration of the deployment. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/change-deployment-config /config:<filename> /slot:production|staging [/warnings-as-error] 
 
Windows Shell Script
Edit|Remove
/change-deployment-config /config:<filename> /name:<deployment-name> [/warnings-as-error] 
 
Initiates an in-place upgrade of the specified deployment. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/upgrade-deployment /mode:auto|manual /label:<label/config:<config-filename/name:<deployment-name> [/warnings-as-error] 
 
 
Windows Shell Script
Edit|Remove
/upgrade-deployment /mode:auto|manual /label:<label/config:<config-filename/slot:staging|production [/warnings-as-error] 
 
Walk the specified upgrade domain. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/walk-upgrade-domain /domain:<update-domain-number/slot:production|staging 
 
 
Windows Shell Script
Edit|Remove
/walk-upgrade-domain /domain:<update-domain-number/name:<deployment-name> 
 
Request the reboot of a single role instance in the deployment. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/reboot-deploymentroleinstance /slot:<staging|production> /role-instance-name:<roleinstancename> 
 
 
Windows Shell Script
Edit|Remove
/reboot-deploymentroleinstance /name:<deploymentname> /role-instance-name:<roleinstancename> 
 
Request the reimaging of a single role instance in the deployment. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/reimage-deploymentroleinstance /slot:<staging|production> /role-instance-name:<roleinstancename> 
 
 
Windows Shell Script
Edit|Remove
/reimage-deploymentroleinstance /name:<deploymentname> /role-instance-name:<roleinstancename> 
 
Certificate Commands
List the certificate thumbprints for a hosted service. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/list-certificates 
 
Add a certificate to the specified hosted service. You must specify the hosted service resource.
Windows Shell Script
Edit|Remove
/add-certificate /cert-file:<path-to-cert-file/cert-format:[pfx] /cert-password:<password> 
 
Deletes certificate with specified thumbprint and algorithm. Should have hosted service resource specified.
Windows Shell Script
Edit|Remove
/delete-certificate /cert-thumbprint:<thumbprint> /algorithm:<algorithm> 
 
Operating System Commands
List all of the operating systems that you can use to create a deployment in Windows Azure.
Windows Shell Script
Edit|Remove
/list-operating-systems 
 
List all of the operating system families and the operating systems that belong to them.
Windows Shell Script
Edit|Remove
/list-operating-system-families 
 
Location Commands
List all of the locations that are accessible from a subscription.
Windows Shell Script
Edit|Remove
/list-locations 
 
Resources
Specify the storage account name.
Windows Shell Script
Edit|Remove
/storage-service:<storage-account-name> 
 
Specify the hosted service name.
Windows Shell Script
Edit|Remove
/hosted-service:<hosted-service-name> 
 
Specify the affinity group.
Windows Shell Script
Edit|Remove
/affinity-group:<affinity-group-name> 
 
Examples
Create a new deployment in staging.
Windows Shell Script
Edit|Remove
csmanage.exe /create-deployment /slot:staging /hosted-service:MyHostedService /name:MyDeployment /label:MyLabel /config:./ServiceConfiguration.cscfg /package:http://myaccount.blob.core.windows.net/packages/MyApplication.cspkg 
 
Update the deployment status to running.
Windows Shell Script
Edit|Remove
csmanage.exe /update-deployment /slot:staging /hosted-service:MyHostedService /status:running 
 
Swap the deployments in the staging and production environments.
Windows Shell Script
Edit|Remove
csmanage.exe /swap-deployment /hosted-service:MyHostedService /source-deployment:MyStagingDeployment /production-slot:MyProductionDeployment 
 
Change the configuration or number of instances. The number of role instances is defined in the ServiceConfiguration.cscfg file.
Windows Shell Script
Edit|Remove
csmanage.exe /change-deployment-config /hosted-service:MyHostedService /slot:production /config:./ServiceConfiguration.cscfg