Index: branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/AzureProvider.cs
===================================================================
--- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/AzureProvider.cs	(revision 7339)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/AzureProvider.cs	(revision 7354)
@@ -40,5 +40,5 @@
     public List<string> ListLocations(Subscription subscription) {
       if (subscription == null) {
-        throw new ArgumentException("Subscription must not be null.", "subscription");
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
       }
       return ServiceManagementOperation.ListLocations(subscription.SubscriptionID, subscription.CertificateThumbprint);
@@ -47,5 +47,5 @@
     public List<HostedService> ListHostedServices(Subscription subscription) {
       if (subscription == null) {
-        throw new ArgumentException("Subscription must not be null.", "subscription");
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
       }
       return ServiceManagementOperation.ListHostedServices(subscription.SubscriptionID, subscription.CertificateThumbprint);
@@ -54,8 +54,53 @@
     public List<AffinityGroup> ListAffinityGroups(Subscription subscription) {
       if (subscription == null) {
-        throw new ArgumentException("Subscription must not be null.", "subscription");
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
       }
       return ServiceManagementOperation.ListAffinityGroups(subscription.SubscriptionID, subscription.CertificateThumbprint);
     }
+
+    public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, AffinityGroup affinityGroup) {
+      if (subscription == null) {
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
+      }
+      if (serviceName.Length == 0) {
+        throw new ArgumentException("Servicename is not valid.", "serviceName");
+      }
+      if (label.Length == 0) {
+        throw new ArgumentException("Label is not valid.", "label");
+      }
+      if (affinityGroup == null) {
+        throw new ArgumentNullException("AffinityGroup must not be null.", "affinityGroup");
+      }
+
+      return ServiceManagementOperation.CreateHostedServiceWithAffinityGroup(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, affinityGroup.Name);
+    }
+
+    public string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location) {
+      if (subscription == null) {
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
+      }
+      if (serviceName.Length == 0) {
+        throw new ArgumentException("Servicename is not valid.", "serviceName");
+      }
+      if (label.Length == 0) {
+        throw new ArgumentException("Label is not valid.", "label");
+      }
+      if (location.Length == 0) {
+        throw new ArgumentException("Location is not valid.", "location");
+      }
+
+      return ServiceManagementOperation.CreateHostedServiceWithLocation(subscription.SubscriptionID, subscription.CertificateThumbprint, serviceName, label, description, location);
+    }
+
+    public string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword) {
+      if (subscription == null) {
+        throw new ArgumentNullException("Subscription must not be null.", "subscription");
+      }
+      if (service == null) {
+        throw new ArgumentNullException("HostedService must not be null.", "service");
+      }
+      return ServiceManagementOperation.AddCertificate(subscription.SubscriptionID, subscription.CertificateThumbprint, service.ServiceName, certficateFilePath, certificatePassword);
+    }
+
   }
 }
Index: branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs
===================================================================
--- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs	(revision 7339)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/IAzureProvider.cs	(revision 7354)
@@ -29,5 +29,7 @@
     List<HostedService> ListHostedServices(Subscription subscription);
     List<AffinityGroup> ListAffinityGroups(Subscription subscription);
-
+    string CreateHostedService(Subscription subscription, string serviceName, string label, string description, AffinityGroup affinityGroup);
+    string CreateHostedService(Subscription subscription, string serviceName, string label, string description, string location);
+    string AddCertificate(Subscription subscription, HostedService service, string certficateFilePath, string certificatePassword);
   }
 }
Index: branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs
===================================================================
--- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs	(revision 7339)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs	(revision 7354)
@@ -169,4 +169,22 @@
     }
 
+    public static string AddCertificate(string subscriptionId, string thumbprint, string serviceName, string certificateFilePath, string password) {
+      string uri = String.Format(Constants.URICertificateFormat, subscriptionId, serviceName);
+      XDocument payload = CreateAddCertificatePayload(certificateFilePath, password);
+      ServiceWebRequest operation = new ServiceWebRequest(thumbprint);
+      string requestId = operation.Invoke(uri, payload);
+      return requestId;
+    }
+
+    public static string CreateHostedServiceWithLocation(string subscriptionId, string thumbprint, string serviceName, string label, string description, string location) {
+      return CreateHostedService(subscriptionId, thumbprint, serviceName, label, description, location, String.Empty);
+    }
+
+    public static string CreateHostedServiceWithAffinityGroup(string subscriptionId, string thumbprint, string serviceName, string label, string description, string affinityGroup) {
+      return CreateHostedService(subscriptionId, thumbprint, serviceName, label, description, String.Empty, affinityGroup);
+    }
+
+
+
     #endregion
 
Index: branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs
===================================================================
--- branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs	(revision 7339)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs	(revision 7354)
@@ -30,18 +30,18 @@
       this.gbNewHostedService = new System.Windows.Forms.GroupBox();
       this.cmbAffinityGroup = new System.Windows.Forms.ComboBox();
-      this.cmbRegion = new System.Windows.Forms.ComboBox();
+      this.cmbLocation = new System.Windows.Forms.ComboBox();
       this.rbAffinitGroup = new System.Windows.Forms.RadioButton();
       this.rbRegion = new System.Windows.Forms.RadioButton();
       this.label6 = new System.Windows.Forms.Label();
       this.label5 = new System.Windows.Forms.Label();
-      this.tbURLPrefix = new System.Windows.Forms.TextBox();
+      this.tbServiceName = new System.Windows.Forms.TextBox();
       this.label4 = new System.Windows.Forms.Label();
-      this.tbServiceName = new System.Windows.Forms.TextBox();
+      this.tbLabel = new System.Windows.Forms.TextBox();
       this.label3 = new System.Windows.Forms.Label();
       this.cbNewHostedService = new System.Windows.Forms.CheckBox();
       this.label7 = new System.Windows.Forms.Label();
       this.panelDeploymentOptions = new System.Windows.Forms.Panel();
+      this.rbDeployToProduction = new System.Windows.Forms.RadioButton();
       this.rbDeployToStaging = new System.Windows.Forms.RadioButton();
-      this.rbDeployToProduction = new System.Windows.Forms.RadioButton();
       this.btnAddCertificate = new System.Windows.Forms.Button();
       this.label9 = new System.Windows.Forms.Label();
@@ -94,12 +94,12 @@
       // 
       this.gbNewHostedService.Controls.Add(this.cmbAffinityGroup);
-      this.gbNewHostedService.Controls.Add(this.cmbRegion);
+      this.gbNewHostedService.Controls.Add(this.cmbLocation);
       this.gbNewHostedService.Controls.Add(this.rbAffinitGroup);
       this.gbNewHostedService.Controls.Add(this.rbRegion);
       this.gbNewHostedService.Controls.Add(this.label6);
       this.gbNewHostedService.Controls.Add(this.label5);
-      this.gbNewHostedService.Controls.Add(this.tbURLPrefix);
+      this.gbNewHostedService.Controls.Add(this.tbServiceName);
       this.gbNewHostedService.Controls.Add(this.label4);
-      this.gbNewHostedService.Controls.Add(this.tbServiceName);
+      this.gbNewHostedService.Controls.Add(this.tbLabel);
       this.gbNewHostedService.Controls.Add(this.label3);
       this.gbNewHostedService.Location = new System.Drawing.Point(15, 115);
@@ -118,11 +118,11 @@
       this.cmbAffinityGroup.TabIndex = 9;
       // 
-      // cmbRegion
-      // 
-      this.cmbRegion.FormattingEnabled = true;
-      this.cmbRegion.Location = new System.Drawing.Point(29, 110);
-      this.cmbRegion.Name = "cmbRegion";
-      this.cmbRegion.Size = new System.Drawing.Size(200, 21);
-      this.cmbRegion.TabIndex = 8;
+      // cmbLocation
+      // 
+      this.cmbLocation.FormattingEnabled = true;
+      this.cmbLocation.Location = new System.Drawing.Point(29, 110);
+      this.cmbLocation.Name = "cmbLocation";
+      this.cmbLocation.Size = new System.Drawing.Size(200, 21);
+      this.cmbLocation.TabIndex = 8;
       // 
       // rbAffinitGroup
@@ -164,10 +164,10 @@
       this.label5.Text = ".cloudapp.net";
       // 
-      // tbURLPrefix
-      // 
-      this.tbURLPrefix.Location = new System.Drawing.Point(9, 71);
-      this.tbURLPrefix.Name = "tbURLPrefix";
-      this.tbURLPrefix.Size = new System.Drawing.Size(377, 20);
-      this.tbURLPrefix.TabIndex = 3;
+      // tbServiceName
+      // 
+      this.tbServiceName.Location = new System.Drawing.Point(9, 71);
+      this.tbServiceName.Name = "tbServiceName";
+      this.tbServiceName.Size = new System.Drawing.Size(377, 20);
+      this.tbServiceName.TabIndex = 3;
       // 
       // label4
@@ -180,10 +180,10 @@
       this.label4.Text = "Enter a URL prefix for your service";
       // 
-      // tbServiceName
-      // 
-      this.tbServiceName.Location = new System.Drawing.Point(9, 32);
-      this.tbServiceName.Name = "tbServiceName";
-      this.tbServiceName.Size = new System.Drawing.Size(453, 20);
-      this.tbServiceName.TabIndex = 1;
+      // tbLabel
+      // 
+      this.tbLabel.Location = new System.Drawing.Point(9, 32);
+      this.tbLabel.Name = "tbLabel";
+      this.tbLabel.Size = new System.Drawing.Size(453, 20);
+      this.tbLabel.TabIndex = 1;
       // 
       // label3
@@ -225,15 +225,4 @@
       this.panelDeploymentOptions.TabIndex = 10;
       // 
-      // rbDeployToStaging
-      // 
-      this.rbDeployToStaging.AutoSize = true;
-      this.rbDeployToStaging.Location = new System.Drawing.Point(0, 4);
-      this.rbDeployToStaging.Name = "rbDeployToStaging";
-      this.rbDeployToStaging.Size = new System.Drawing.Size(168, 17);
-      this.rbDeployToStaging.TabIndex = 0;
-      this.rbDeployToStaging.TabStop = true;
-      this.rbDeployToStaging.Text = "Deploy to staging environment";
-      this.rbDeployToStaging.UseVisualStyleBackColor = true;
-      // 
       // rbDeployToProduction
       // 
@@ -246,4 +235,16 @@
       this.rbDeployToProduction.Text = "Deyploy to production environment";
       this.rbDeployToProduction.UseVisualStyleBackColor = true;
+      // 
+      // rbDeployToStaging
+      // 
+      this.rbDeployToStaging.AutoSize = true;
+      this.rbDeployToStaging.Checked = true;
+      this.rbDeployToStaging.Location = new System.Drawing.Point(0, 4);
+      this.rbDeployToStaging.Name = "rbDeployToStaging";
+      this.rbDeployToStaging.Size = new System.Drawing.Size(168, 17);
+      this.rbDeployToStaging.TabIndex = 0;
+      this.rbDeployToStaging.TabStop = true;
+      this.rbDeployToStaging.Text = "Deploy to staging environment";
+      this.rbDeployToStaging.UseVisualStyleBackColor = true;
       // 
       // btnAddCertificate
@@ -360,12 +361,12 @@
     private System.Windows.Forms.GroupBox gbNewHostedService;
     private System.Windows.Forms.ComboBox cmbAffinityGroup;
-    private System.Windows.Forms.ComboBox cmbRegion;
+    private System.Windows.Forms.ComboBox cmbLocation;
     private System.Windows.Forms.RadioButton rbAffinitGroup;
     private System.Windows.Forms.RadioButton rbRegion;
     private System.Windows.Forms.Label label6;
     private System.Windows.Forms.Label label5;
-    private System.Windows.Forms.TextBox tbURLPrefix;
+    private System.Windows.Forms.TextBox tbServiceName;
     private System.Windows.Forms.Label label4;
-    private System.Windows.Forms.TextBox tbServiceName;
+    private System.Windows.Forms.TextBox tbLabel;
     private System.Windows.Forms.Label label3;
     private System.Windows.Forms.CheckBox cbNewHostedService;
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 7339)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 7354)
@@ -14,15 +14,23 @@
     private BindingList<AffinityGroup> affinityGroups;
 
-    private BackgroundWorker worker = new BackgroundWorker();
+    private BackgroundWorker worker;
+
+    private bool isInitializing;
+    private bool bwCompleted;
+    private bool closePending;
 
     public AddAzureServiceDialog(IItemList<Subscription> subs) {
       InitializeComponent();
+      isInitializing = true;
 
       this.subscriptions = new BindingList<Subscription>(subs);
+      this.hostedServices = new BindingList<HostedService>();
+      this.locations = new BindingList<string>();
+      this.affinityGroups = new BindingList<AffinityGroup>();
 
+      SetLookupBinding(cmbLocation, locations, "", "");
+      SetLookupBinding(cmbAffinityGroup, affinityGroups, "Label", "Name");
+      SetLookupBinding(cmbChooseHostedService, hostedServices, "ServiceName", "ServiceName");
       SetLookupBinding(cmbChooseSubscription, subscriptions, "SubscriptionName", "SubscriptionID");
-      SetLookupBinding(cmbChooseHostedService, hostedServices, "ServiceName", "ServiceName");
-      SetLookupBinding(cmbRegion, locations, "", "");
-      SetLookupBinding(cmbAffinityGroup, affinityGroups, "Label", "Name");
 
       if (!cbNewHostedService.Checked) {
@@ -30,6 +38,20 @@
       }
 
+      worker = new BackgroundWorker();
       worker.DoWork += new DoWorkEventHandler(UpdateTask);
       worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerCompleted);
+
+
+      isInitializing = false;
+      cmbChooseSubscription_SelectedValueChanged(this, EventArgs.Empty);
+    }
+
+    protected override void OnFormClosing(FormClosingEventArgs e) {
+      if (!bwCompleted) {
+        worker.CancelAsync();
+        this.Enabled = false;
+        e.Cancel = true;
+        closePending = true;
+      }
     }
 
@@ -61,4 +83,12 @@
     }
 
+    private void UpdateBindingList<T>(BindingList<T> bindinglist, List<T> list) {
+      if (list != null) {
+        bindinglist.Clear();
+        foreach (T item in list)
+          bindinglist.Add(item);
+      }
+    }
+
     private void cbNewHostedService_CheckedChanged(object sender, EventArgs e) {
       if (cbNewHostedService.Checked) {
@@ -81,8 +111,10 @@
 
     private void cmbChooseSubscription_SelectedValueChanged(object sender, EventArgs e) {
-      Subscription item = (Subscription)cmbChooseSubscription.SelectedItem;
-      if (item != null) {
-        progressBar.Visible = true;
-        worker.RunWorkerAsync(item);
+      if (!isInitializing) {
+        Subscription item = (Subscription)cmbChooseSubscription.SelectedItem;
+        if (item != null) {
+          progressBar.Visible = true;
+          worker.RunWorkerAsync(item);
+        }
       }
     }
@@ -101,5 +133,16 @@
     private void btnOk_Click(object sender, EventArgs e) {
       if (cmbChooseSubscription.SelectedItem != null) {
-        // TODO
+        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
+          }
+        }
+
       }
     }
@@ -113,7 +156,11 @@
         this.Invoke((MethodInvoker)delegate { lblCores.Text = item.CurrentCoreCount + " / " + item.MaxCoreCount; });
 
-        SetBindingList<HostedService>(ref hostedServices, CloudManagerClient.Instance.AzureProvider.ListHostedServices(item));
-        SetBindingList<string>(ref locations, CloudManagerClient.Instance.AzureProvider.ListLocations(item));
-        SetBindingList<AffinityGroup>(ref affinityGroups, CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item));
+        List<HostedService> services = CloudManagerClient.Instance.AzureProvider.ListHostedServices(item);
+        List<string> locs = CloudManagerClient.Instance.AzureProvider.ListLocations(item);
+        List<AffinityGroup> groups = CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item);
+
+        this.Invoke((MethodInvoker)delegate { UpdateBindingList<HostedService>(hostedServices, services); });
+        this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); });
+        this.Invoke((MethodInvoker)delegate { UpdateBindingList<AffinityGroup>(affinityGroups, groups); });
 
         SetAllControlsEnabled(this, true);
@@ -126,4 +173,8 @@
     private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
       this.Invoke((MethodInvoker)delegate { progressBar.Visible = false; });
+      bwCompleted = true;
+      if (closePending) {
+        this.Close();
+      }
     }
   }
