/// <summary>
 /// Returns the configuration file for the particular role
 /// </summary>
 private CscfgFile GetConfiguration(string roleName)
 {
     RoleName = roleName;
     // get the details configuration for the role
     var command = new GetDeploymenConfigurationCommand(ServiceName, DeploymentSlot)
         {
             SubscriptionId = SubscriptionId,
             Certificate = ManagementCertificate
         };
     command.Execute();
     // use the configuration and reset the instance count for the role in question
     var config = command.Configuration;
     return config;
 }
 /// <summary>
 /// Updates a role instance count within a cloud services
 /// </summary>
 public void UpdateRoleInstanceCount(string roleName, int instanceCount)
 {
     var config = new GetDeploymenConfigurationCommand(Name)
         {
             SubscriptionId = SubscriptionId,
             Certificate = ManagementCertificate
         };
     config.Execute();
     config.Configuration.SetInstanceCountForRole(roleName, instanceCount);
     var update = new SetDeploymenConfigurationCommand(Name, config.Configuration)
         {
             SubscriptionId = SubscriptionId,
             Certificate = ManagementCertificate
         };
     update.Execute();
 }
 /// <summary>
 /// Gets the deployment configuration in the production slot for a cloud service
 /// </summary>
 /// <param name="serviceName">The name of the cloud service</param>
 /// <returns>A CscfgFile instance</returns>
 CscfgFile IQueryCloudService.GetConfigurationForProductionDeploymentForServiceWithName(string serviceName)
 {
     // build the hosted service list command here
     var command = new GetDeploymenConfigurationCommand(serviceName)
     {
         SubscriptionId = SubscriptionId,
         Certificate = ManagementCertificate
     };
     command.Execute();
     return command.Configuration;
 }