private void StopAndRemove(string rootName, string serviceName, string subscription, string slot) { GetDeploymentStatus getDeployment = new GetDeploymentStatus(this.Channel); if (getDeployment.DeploymentExists(rootName, serviceName, slot, subscription)) { DeploymentStatusManager setDeployment = new DeploymentStatusManager(this.Channel); setDeployment.SetDeploymentStatusProcess(rootName, DeploymentStatus.Suspended, slot, subscription, serviceName); getDeployment.WaitForState(DeploymentStatus.Suspended, rootName, serviceName, slot, subscription); RemoveAzureDeploymentCommand removeDeployment = new RemoveAzureDeploymentCommand(this.Channel); removeDeployment.RemoveAzureDeploymentProcess(rootName, serviceName, slot, subscription); while (getDeployment.DeploymentExists(rootName, serviceName, slot, subscription)) ; } }