Microsoft.WindowsAzure.Commands.Utilities.CloudService.CloudServiceProject.SetRoleInstances C# (CSharp) Method

SetRoleInstances() public method

Sets the role instance count
public SetRoleInstances ( CloudProjectPathInfo paths, string roleName, int instances ) : void
paths CloudProjectPathInfo The service paths
roleName string The name of the role to change its instance count
instances int
return void
        public void SetRoleInstances(CloudProjectPathInfo paths, string roleName, int instances)
        {
            Components.SetRoleInstances(roleName, instances);
            Components.Save(paths);
        }

Usage Example

        /// <summary>
        /// The code to run if setting azure instances
        /// </summary>
        /// <param name="roleName">The name of the role to update</param>
        /// <param name="instances">The new number of instances for the role</param>
        /// <param name="rootPath">The root path to the service containing the role</param>
        /// <returns>Role after updating instance count</returns>
        public RoleSettings SetAzureInstancesProcess(string roleName, int instances, string rootPath)
        {
            CloudServiceProject service = new CloudServiceProject(rootPath, null);
            service.SetRoleInstances(service.Paths, roleName, instances);

            if (PassThru)
            {
                SafeWriteOutputPSObject(typeof(RoleSettings).FullName, Parameters.RoleName, roleName);
            }

            return service.Components.GetCloudConfigRole(roleName);
        }
All Usage Examples Of Microsoft.WindowsAzure.Commands.Utilities.CloudService.CloudServiceProject::SetRoleInstances