Index: /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/Constants.cs
===================================================================
--- /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/Constants.cs	(revision 7365)
+++ /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/Constants.cs	(revision 7366)
@@ -74,4 +74,14 @@
 
     #endregion
+
+    #region Deployment
+
+    public const string DeploymentSlotStaging = "staging";
+    public const string DeploymentSlotProduction = "production";
+    public const string DeploymentPackageUrl = "https://hivestorage.blob.core.windows.net/hiveslave/HeuristicLab.Clients.Hive.Slave.Azure.cspkg";
+    public const string DeploymentConfigurationUrl = "files/ServiceConfiguration.Cloud.cscfg";
+    public const string DeploymentLabel = "HeuristicLab.Hive.Slave";
+
+    #endregion
   }
 }
Index: /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs
===================================================================
--- /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 7365)
+++ /branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 7366)
@@ -13,5 +13,6 @@
     private BindingList<AffinityGroup> affinityGroups;
 
-    private BackgroundWorker worker;
+    private BackgroundWorker workerUpdate;
+    private BackgroundWorker workerCreate;
 
     private bool isInitializing;
@@ -41,8 +42,11 @@
       }
 
-      worker = new BackgroundWorker();
-      worker.DoWork += new DoWorkEventHandler(UpdateTask);
-      worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted);
-
+      workerUpdate = new BackgroundWorker();
+      workerUpdate.DoWork += new DoWorkEventHandler(UpdateTask);
+      workerUpdate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted);
+
+      workerCreate = new BackgroundWorker();
+      workerCreate.DoWork += new DoWorkEventHandler(CreateDoploymentTask);
+      workerCreate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CreateDeploymentCompleted);
 
       isInitializing = false;
@@ -90,4 +94,13 @@
         foreach (T item in list)
           bindinglist.Add(item);
+      }
+    }
+
+    private void UpdateSubscriptionItem(BindingList<Subscription> bindinglist, Subscription item) {
+      if (item != null) {
+        foreach (Subscription blItem in bindinglist)
+          if (blItem.Equals(item)) {
+            blItem.Merge(item);
+          }
       }
     }
@@ -119,5 +132,5 @@
           progressBar.Visible = true;
           SetAllControlsEnabled(this, false);
-          worker.RunWorkerAsync(item);
+          workerUpdate.RunWorkerAsync(item);
         }
       }
@@ -141,15 +154,31 @@
     private void btnOk_Click(object sender, EventArgs e) {
       if (cmbChooseSubscription.SelectedItem != null) {
-        if (cbNewHostedService.Checked) {
-          if (rbRegion.Checked) {
-            string serviceName = tbServiceName.Text;
-            string label = tbLabel.Text;
-            string location = (string)cmbLocation.SelectedItem;
-            Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem;
-            CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, serviceName, label, "Hosted service for hive slave", location);
-          } else {
-            // rbAffinitGroup.Checked
-          }
-        }
+        Subscription sub = (Subscription)cmbChooseSubscription.SelectedItem;
+        bool newHostedServiceChecked = cbNewHostedService.Checked;
+        bool regionChecked = rbRegion.Checked;
+        string certFile = certificateFile;
+        string certPw = certificatePassword;
+        int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
+        HostedService hostedService = new HostedService();
+        hostedService.ServiceName = tbServiceName.Text;
+        HostedServiceProperties properties = new HostedServiceProperties();
+        if (regionChecked) {
+          properties.AffinityGroup = string.Empty;
+          properties.Location = (string)cmbLocation.SelectedItem;
+        } else {
+          properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
+          properties.Location = string.Empty;
+        }
+        properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
+        properties.Label = tbLabel.Text;
+        properties.Location = (string)cmbLocation.SelectedItem;
+        hostedService.HostedServiceProperties = properties;
+
+        var parameters = Tuple.Create<Subscription, bool, bool, string, string, HostedService, int>(sub, newHostedServiceChecked, regionChecked, certificateFile, certificatePassword, hostedService, instanceCount);
+
+        bwCompleted = false;
+        progressBar.Visible = true;
+        SetAllControlsEnabled(this, false);
+        workerCreate.RunWorkerAsync(parameters);
       }
     }
@@ -165,4 +194,5 @@
         List<AffinityGroup> groups = CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item);
 
+        this.Invoke((MethodInvoker)delegate { UpdateSubscriptionItem(subscriptions, item); });
         this.Invoke((MethodInvoker)delegate { UpdateBindingList<HostedService>(hostedServices, services); });
         this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); });
@@ -182,4 +212,35 @@
       }
     }
+
+    private void CreateDoploymentTask(object sender, DoWorkEventArgs e) {
+      Tuple<Subscription, bool, bool, string, string, HostedService, int> parameters = (Tuple<Subscription, bool, bool, string, string, HostedService, int>)e.Argument;
+
+      Subscription sub = parameters.Item1;
+      bool newHostedServiceChecked = parameters.Item2;
+      bool regionChecked = parameters.Item3;
+      string certFile = parameters.Item4;
+      string certPw = parameters.Item5;
+      HostedService hostedService = parameters.Item6;
+      int instanceCount = parameters.Item7;
+
+      //STEP 1 - Create Hosted Service
+      if (newHostedServiceChecked) {
+        if (regionChecked) {
+          CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, hostedService.ServiceName, hostedService.HostedServiceProperties.Label, hostedService.HostedServiceProperties.Description, hostedService.HostedServiceProperties.Location);
+        } else {
+          CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, hostedService.ServiceName, hostedService.HostedServiceProperties.Label, hostedService.HostedServiceProperties.Description, new AffinityGroup() { Name = hostedService.HostedServiceProperties.AffinityGroup });
+        }
+      }
+
+    }
+
+    private void CreateDeploymentCompleted(object sender, RunWorkerCompletedEventArgs e) {
+      SetAllControlsEnabled(this, true);
+      progressBar.Visible = false;
+      bwCompleted = true;
+      if (closePending) {
+        this.Close();
+      }
+    }
   }
 }
