seeazure: Administration of Azure deployments and Services

Seeazure is a command line utility that can be used to deploy packages to Azure and control aspects of the Azure environment and the deployments therein. Whilst not exhaustive in functionality, it is rich enough to perform the required tasks .

seeazure  -command [-resourcetype:resourcename] [optional_parameters]

Configuration Settings

All operations need the following settings specified in seeazure.exe.config:

  • SubscriptionID : Your subscription ID. You can find this in the "Account" tab of the Windows Azure Developer Portal.
  • CertificateThumbprint : Hex thumbprint of a X509 certificate previously uploaded in the "API Certificates" section of the Windows Azure developer portal.

    See the Azure documentation for how to generate and store these certificates.

These values can be overridden by using command line switches:

  • -subscription_id:<subscription id>
  • -subscription_cert_thumbprint:<thumbprint>

Resources

Specific operations will require one of the following resources to be defined:

  • -storage_service:<storage_account_name>

    Specifies the storage service/account name for commands that deal with storage account operations.

  • -hosted_service:<hosted_service_name>

    Specifies the hosted service name for commands that deal with hosted service operations.

  • -affinity_group:<affinity_group_name>

    Specifies the affinity group for commands that deal with affinity groups.

  • -location:<location_constraint_name>

    Specifies the location constraint for commands that deal with locations.

Commands

  • General Operations:
    • -?

      Display this message

    • -get_operation_status -op_id:<operation_id>

      Shows status of specified operation_id.

  • Affinity Group Operations:
    • -view_affinity_group_properties -affinity_group<affinity_group_name>

      Lists the properties for the affinity group .

    • -list_affinity_groups

      Lists all affinity groups in the subscription. Use view_properties to display details on any particular affinity group.

  • Storage Account Operations:
    • -view_storage_service_properties -storage_service:<storage_service_name>

      Lists the properties for the storage_service.

    • -list_storage_services

      Lists all storage services underneath the subscription.

    • -view_keys

      Acts on storage accounts only. Displays the primary and secondary keys for the account. Should have the storage account resource specified.

    • -regenerate_key -key_type:primary|secondary

      Acts on storage accounts only. Regenerates storage keys with the key_type parameter specifying which key to regenerate. Should have the storage account resource specified.

    • -deploy_file -file:name:<full path to file> -container_name:<containername> -target_file_name:<targetfilename>

      Deploys the file name pointed to by the full path to a container identified with <containername> with a target filename identified by <targetfilename>.

      The primary key of the storage_service identified by the -storage_service parameter is retrieved and used to store the file in blob storage.

  • Hosted Service Operations:
    • -view_hosted_service_properties -hosted_service:<hosted_service_name>

      Lists the properties for the hosted_service.

    • -create_hosted_service -hosted_service:<name> -label:<label> [-description:<description>] [-affinity_group:<affinitygroupname> -location:<locationconstraintname>]

      Creates a hosted service.

    • -list_hosted_services

      Lists all hosted services under the subscription. Use -view_properties to view details on a particular hosted service.

    • -update_hosted_service -hosted_service:<name> [-label:<label>] [-description:<description>]

      Updates a hosted service.

    • -delete_hosted_service

      Deletes hosted service. Should have the hosted_service resource specified.

  • Deployment Operations:

    The deployment operations require that the hosted service resource is specified.

    • -view_deployment -slot:staging|production

      View details of a specified deployment. You can specify the deployment either by slot type or by name.

    • -view_deployment -name:<deployment_name>

      View details of a specified deployment. You can specify the deployment either by slot type or by name.

    • -create_deployment -name:<name_of_deployment> -label:<label> -package:<blob_uri> -config:<filename> -slot:staging|production [-warnings_as_error]

      Create a new deployment. The package parameter should have the URI to a .cspkg in blob storage whose storage account is part of the same subscription-project. The -config parameter should specifiy a .cscfg file on disk. Note that there shouldn't be a deployment of the same name or in the same slot when executing this command. If -warnings_as_error is specified, warnings are returned and operation is terminated.

    • -swap_deployment -production_slot:<deployment_name_in_production> -source_deployment:<deployment_name_in_staging>

      Swaps the deployments in production and stage. To make sure the command works on the deployments you expect them to, you need to pass the name of the deployment currently in production and the name of the deployment currently in staging. If you don't have any resource in production, you can leave it empty.

    • -delete_deployment -name:<deployment_name>

      Deletes the specified deployment. Note that the deployment should be in suspended state.

    • -delete_deployment -slot:production|staging

      Deletes the specified deployment. Note that the deployment should be in suspended state.

    • -update_deployment -status:running|suspended -name:<deployment_name>

      Change deployment status to running or suspended.

    • -update_deployment -status:running|suspended -slot:production|staging

      Change deployment status to running or suspended.

    • -change_deployment_config -config:<filename> -slot:production|staging [-warnings_as_error]

      Change the deployment's configuration.

    • -change_deployment_config -config:<filename> -name:<deployment_name> [-warnings_as_error]

      Change the deployment's configuration.

    • -upgrade_deployment -mode:auto|manual -label:<label> -config:<config_filename> -name:<deployment_name> [-warnings_as_error]

      Initiates an in_place upgrade of the specified deployment.

    • -upgrade_deployment -mode:auto|manual -label:<label> -config:<config_filename> -slot:staging|production [-warnings_as_error]

      Initiates an in place upgrade of the specified deployment.

    • -walk_upgrade_domain -domain:<update_domain_number> -slot:production|staging

      Walks the specified upgrade domain.

    • -walk_upgrade_domain -domain:<update_domain_number> -name:<deployment_name>

      Walks the specified upgrade domain.

    • -reboot_deploymentroleinstance -slot:<staging|production> -role_instance_name:<roleinstancename>

      Requests the reboot of a single role instance in the deployment.

    • -reboot_deploymentroleinstance -name:<deploymentname> -role_instance_name:<roleinstancename>

      Requests the reboot of a single role instance in the deployment.

    • -reimage_deploymentroleinstance -slot:<staging|production> -role_instance_name:<roleinstancename>

      Requests the reimaging of a single role instance in the deployment.

    • -reimage_deploymentroleinstance -name:<deploymentname> -role_instance_name:<roleinstancename>

      Requests the reimaging of a single role instance in the deployment.

  • Certificate Operations:

    These operations require that the hosted service resource is specified.

    • -list_certificates

      Lists certificate thrumbprints for a hosted service.

    • -add_certificate -cert_file:<path_to_cert_file> -cert_format:[pfx] -cert_password:<password>

      Adds a certificate to the specified hosted service. . pfx is the only format supported currently

    • -delete_certificate -cert_thumbprint:<thumbprint> -algorithm:<algorithm>

      Deletes certificate with specified thumbprint and algorithm.

  • Operating System Operations:
    • -list_operating_systems

      Lists all operating systems that can be used when creating deployments in Windows Azure.

    • -list_operating_system_families

      Lists all operating system families and the operating systems that belong to them.

  • Location Operations:
    • -list_locations

      Lists all locations accessible from a given subscription.

Examples

Deploying a package file to Azure Storage mfcics1 in preparation for a deployment

seeazure -deploy_file 
               -storage_service:mfcics1 
               -file_name:"d:\dev\app.publish\SEECloud.cspkg" 
               -container_name:vsdeploy -target_file_name:SEECloud.cspkg

Creating a new deployment in staging

This assumes that there is a storage account called 'myaccount' under the same subscription and a package in the 'packages' container. It also uses a SEECloud.cscfg config file in the current working directory.

seeazure -create_deployment 
               -slot:staging 
               -hosted_service:testhostedservice 
               -name:testdep 
               -label:testlabel 
               -config:.\SEECloud.cscfg    
               -package:http://myaccount.blob.core.windows.net/vsdeploy/SEECloud.cspkg

Updating deployment status to running

seeazure -update_deployment 
               -slot:staging 
               -hosted_service:testhostedservice
               -status:running
We could replace the last parameter with a -name parameter as well.

Swapping staging and production

seeazure -swap_deployment 
               -hosted_service:testhostedservice
               -source_deployment:testdep 
               -production_slot:somedeploymentinprod

Changing configuration number of instances

We'll assume the configuration file has the number of role instances specified.

seeazure -change_deployment_config 
               -hosted_service:testhostedservice 
               -slot:production
               -config:./SEECloud.cscfg