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 7550)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs	(revision 7551)
@@ -55,9 +55,9 @@
       this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
       this.gbStorageService = new System.Windows.Forms.GroupBox();
+      this.cbCreateBlobIfNotExists = new System.Windows.Forms.CheckBox();
+      this.tbBlobContainer = new System.Windows.Forms.TextBox();
+      this.label11 = new System.Windows.Forms.Label();
+      this.cmbStorageServices = new System.Windows.Forms.ComboBox();
       this.label8 = new System.Windows.Forms.Label();
-      this.comboBox1 = new System.Windows.Forms.ComboBox();
-      this.label11 = new System.Windows.Forms.Label();
-      this.tbBlobContainer = new System.Windows.Forms.TextBox();
-      this.cbCreateBlobIfNotExists = new System.Windows.Forms.CheckBox();
       this.rbVMSizeMedium = new System.Windows.Forms.RadioButton();
       this.rbVMSizeSmall = new System.Windows.Forms.RadioButton();
@@ -108,4 +108,5 @@
       this.cmbChooseHostedService.Size = new System.Drawing.Size(486, 21);
       this.cmbChooseHostedService.TabIndex = 6;
+      this.cmbChooseHostedService.Validating += new System.ComponentModel.CancelEventHandler(this.cmbChooseHostedService_Validating);
       // 
       // gbNewHostedService
@@ -341,5 +342,5 @@
       this.gbStorageService.Controls.Add(this.tbBlobContainer);
       this.gbStorageService.Controls.Add(this.label11);
-      this.gbStorageService.Controls.Add(this.comboBox1);
+      this.gbStorageService.Controls.Add(this.cmbStorageServices);
       this.gbStorageService.Controls.Add(this.label8);
       this.gbStorageService.Location = new System.Drawing.Point(15, 267);
@@ -350,4 +351,42 @@
       this.gbStorageService.Text = "Set storage service";
       // 
+      // cbCreateBlobIfNotExists
+      // 
+      this.cbCreateBlobIfNotExists.AutoSize = true;
+      this.cbCreateBlobIfNotExists.Checked = true;
+      this.cbCreateBlobIfNotExists.CheckState = System.Windows.Forms.CheckState.Checked;
+      this.cbCreateBlobIfNotExists.Location = new System.Drawing.Point(9, 98);
+      this.cbCreateBlobIfNotExists.Name = "cbCreateBlobIfNotExists";
+      this.cbCreateBlobIfNotExists.Size = new System.Drawing.Size(182, 17);
+      this.cbCreateBlobIfNotExists.TabIndex = 21;
+      this.cbCreateBlobIfNotExists.Text = "Create blob container if not exists";
+      this.cbCreateBlobIfNotExists.UseVisualStyleBackColor = true;
+      // 
+      // tbBlobContainer
+      // 
+      this.tbBlobContainer.Location = new System.Drawing.Point(9, 72);
+      this.tbBlobContainer.Name = "tbBlobContainer";
+      this.tbBlobContainer.Size = new System.Drawing.Size(452, 20);
+      this.tbBlobContainer.TabIndex = 10;
+      this.tbBlobContainer.Validating += new System.ComponentModel.CancelEventHandler(this.tbBlobContainer_Validating);
+      // 
+      // label11
+      // 
+      this.label11.AutoSize = true;
+      this.label11.Location = new System.Drawing.Point(6, 56);
+      this.label11.Name = "label11";
+      this.label11.Size = new System.Drawing.Size(96, 13);
+      this.label11.TabIndex = 11;
+      this.label11.Text = "Set blob container:";
+      // 
+      // cmbStorageServices
+      // 
+      this.cmbStorageServices.FormattingEnabled = true;
+      this.cmbStorageServices.Location = new System.Drawing.Point(9, 32);
+      this.cmbStorageServices.Name = "cmbStorageServices";
+      this.cmbStorageServices.Size = new System.Drawing.Size(452, 21);
+      this.cmbStorageServices.TabIndex = 10;
+      this.cmbStorageServices.Validating += new System.ComponentModel.CancelEventHandler(this.cmbStorageServices_Validating);
+      // 
       // label8
       // 
@@ -358,38 +397,4 @@
       this.label8.TabIndex = 10;
       this.label8.Text = "Select storage account:";
-      // 
-      // comboBox1
-      // 
-      this.comboBox1.FormattingEnabled = true;
-      this.comboBox1.Location = new System.Drawing.Point(9, 32);
-      this.comboBox1.Name = "comboBox1";
-      this.comboBox1.Size = new System.Drawing.Size(452, 21);
-      this.comboBox1.TabIndex = 10;
-      // 
-      // label11
-      // 
-      this.label11.AutoSize = true;
-      this.label11.Location = new System.Drawing.Point(6, 56);
-      this.label11.Name = "label11";
-      this.label11.Size = new System.Drawing.Size(96, 13);
-      this.label11.TabIndex = 11;
-      this.label11.Text = "Set blob container:";
-      // 
-      // tbBlobContainer
-      // 
-      this.tbBlobContainer.Location = new System.Drawing.Point(9, 72);
-      this.tbBlobContainer.Name = "tbBlobContainer";
-      this.tbBlobContainer.Size = new System.Drawing.Size(452, 20);
-      this.tbBlobContainer.TabIndex = 10;
-      // 
-      // cbCreateBlobIfNotExists
-      // 
-      this.cbCreateBlobIfNotExists.AutoSize = true;
-      this.cbCreateBlobIfNotExists.Location = new System.Drawing.Point(9, 98);
-      this.cbCreateBlobIfNotExists.Name = "cbCreateBlobIfNotExists";
-      this.cbCreateBlobIfNotExists.Size = new System.Drawing.Size(182, 17);
-      this.cbCreateBlobIfNotExists.TabIndex = 21;
-      this.cbCreateBlobIfNotExists.Text = "Create blob container if not exists";
-      this.cbCreateBlobIfNotExists.UseVisualStyleBackColor = true;
       // 
       // rbVMSizeMedium
@@ -490,5 +495,8 @@
       this.Controls.Add(this.cmbChooseSubscription);
       this.Controls.Add(this.label1);
+      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
       this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+      this.MaximizeBox = false;
+      this.MinimizeBox = false;
       this.Name = "AddAzureServiceDialog";
       this.Text = "Create New Azure Slave";
@@ -545,5 +553,5 @@
     private System.Windows.Forms.TextBox tbBlobContainer;
     private System.Windows.Forms.Label label11;
-    private System.Windows.Forms.ComboBox comboBox1;
+    private System.Windows.Forms.ComboBox cmbStorageServices;
     private System.Windows.Forms.Label label8;
     private System.Windows.Forms.ToolTip toolTip;
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 7550)
+++ branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs	(revision 7551)
@@ -7,4 +7,6 @@
 using HeuristicLab.Clients.Hive.CloudManager.Model;
 using HeuristicLab.Core;
+using Microsoft.WindowsAzure;
+using Microsoft.WindowsAzure.StorageClient;
 
 namespace HeuristicLab.Clients.Hive.CloudManager.Views {
@@ -14,4 +16,5 @@
     private BindingList<string> locations;
     private BindingList<AffinityGroup> affinityGroups;
+    private BindingList<StorageService> storageServices;
 
     private BackgroundWorker workerUpdate;
@@ -34,4 +37,5 @@
       this.locations = new BindingList<string>();
       this.affinityGroups = new BindingList<AffinityGroup>();
+      this.storageServices = new BindingList<StorageService>();
 
       SetLookupBinding(cmbLocation, locations, "", "");
@@ -39,4 +43,5 @@
       SetLookupBinding(cmbChooseHostedService, hostedServices, "ServiceName", "ServiceName");
       SetLookupBinding(cmbChooseSubscription, subscriptions, "SubscriptionName", "SubscriptionID");
+      SetLookupBinding(cmbStorageServices, storageServices, "ServiceName", "Url");
 
       if (!cbNewHostedService.Checked) {
@@ -52,5 +57,5 @@
 
       workerCreate = new BackgroundWorker();
-      workerCreate.DoWork += new DoWorkEventHandler(CreateDoploymentTask);
+      workerCreate.DoWork += new DoWorkEventHandler(CreateDeploymentTask);
       workerCreate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CreateDeploymentCompleted);
 
@@ -187,5 +192,16 @@
           hostedService.HostedServiceProperties = properties;
 
-          var parameters = Tuple.Create<Subscription, bool, bool, string, string, HostedService, int>(sub, newHostedServiceChecked, regionChecked, certificateFile, certificatePassword, hostedService, instanceCount);
+          //var parameters1 = Tuple.Create<Subscription, bool, bool, string, string, HostedService, int>
+          //  (sub, newHostedServiceChecked, regionChecked, certificateFile, certificatePassword, hostedService, instanceCount);
+          CreateDeploymentData parameters = new CreateDeploymentData();
+          parameters.Subscription = sub;
+          parameters.CreateNewHosteService = newHostedServiceChecked;
+          parameters.UseRegion = regionChecked;
+          parameters.CertificateFilePath = certificateFile;
+          parameters.CertificatePassword = certificatePassword;
+          parameters.HostedService = hostedService;
+          parameters.InstanceCount = instanceCount;
+          parameters.StorageService = (StorageService)cmbStorageServices.SelectedItem;
+          parameters.BlobContainerName = tbBlobContainer.Text;
 
           bwCompleted = false;
@@ -206,4 +222,5 @@
         List<string> locs = CloudManagerClient.Instance.AzureProvider.ListLocations(item);
         List<AffinityGroup> groups = CloudManagerClient.Instance.AzureProvider.ListAffinityGroups(item);
+        List<StorageService> storage = CloudManagerClient.Instance.AzureProvider.ListStorageServices(item);
 
         this.Invoke((MethodInvoker)delegate { UpdateSubscriptionItem(subscriptions, item); });
@@ -211,4 +228,5 @@
         this.Invoke((MethodInvoker)delegate { UpdateBindingList<string>(locations, locs); });
         this.Invoke((MethodInvoker)delegate { UpdateBindingList<AffinityGroup>(affinityGroups, groups); });
+        this.Invoke((MethodInvoker)delegate { UpdateBindingList<StorageService>(storageServices, storage); });
       }
       catch (Exception ex) {
@@ -226,19 +244,47 @@
     }
 
-    private void CreateDoploymentTask(object sender, DoWorkEventArgs e) {
+    private void CreateDeploymentTask(object sender, DoWorkEventArgs e) {
       bool errorOccured = false;
-      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;
+      CreateDeploymentData parameters = (CreateDeploymentData)e.Argument;
+
+      Subscription sub = parameters.Subscription;
+      bool newHostedServiceChecked = parameters.CreateNewHosteService;
+      bool regionChecked = parameters.UseRegion;
+      string certFile = parameters.CertificateFilePath;
+      string certPw = parameters.CertificatePassword;
+      HostedService hostedService = parameters.HostedService;
+      int instanceCount = parameters.InstanceCount;
+      StorageService storageService = parameters.StorageService;
+      string blobContainerName = parameters.BlobContainerName;
+      bool createContainerIfNotExists = parameters.CreateContainerIfNotExists;
+
+      CloudStorageAccount storageAccount;
+      CloudBlobClient blobClient;
+      CloudBlobContainer blobContainer;
+
+      // STEP 1 - Initialize storage account
+      try {
+        // get access key to storage service
+        StorageServiceKeys keys = CloudManagerClient.Instance.AzureProvider.GetStorageKeys(sub, storageService.ServiceName);
+        storageAccount = CloudStorageAccount.Parse(string.Format(Constants.StorageServiceConnectionFormat, storageService.ServiceName, keys.Primary));
+        blobClient = storageAccount.CreateCloudBlobClient();
+        blobContainer = blobClient.GetContainerReference(blobContainerName);
+        if (createContainerIfNotExists) {
+          blobContainer.CreateIfNotExist();
+        } else {
+          if (!blobContainer.Exists()) {
+            throw new ApplicationException("Specified blob container doesn't exist.");
+          }
+        }
+      }
+      catch (Exception ex) {
+        errorOccured = true;
+        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+      }
+
 
       // STEP 1 - Create Hosted Service
       try {
-        if (newHostedServiceChecked) {
+        if ((!errorOccured) && (newHostedServiceChecked)) {
           if (regionChecked) {
             CloudManagerClient.Instance.AzureProvider.CreateHostedService(sub, hostedService.ServiceName, hostedService.HostedServiceProperties.Label, hostedService.HostedServiceProperties.Description, hostedService.HostedServiceProperties.Location);
@@ -337,4 +383,14 @@
     }
 
+    private bool isValidStorageContainerName(string name) {
+      string regexString = @"[a-z0-9]+[a-z0-9-]{0,61}[a-z0-9]+";  //TODO
+      Regex regex = new Regex(regexString);
+      if (regex.IsMatch(name)) {
+        return true;
+      } else {
+        return false;
+      }
+    }
+
     private void tbInstanceCount_Validating(object sender, CancelEventArgs e) {
       if (!isValidInstanceCount(tbInstanceCount.Text)) {
@@ -363,4 +419,50 @@
       }
     }
+
+    private void tbBlobContainer_Validating(object sender, CancelEventArgs e) {
+      string name = tbBlobContainer.Text.Trim();
+      if (name == string.Empty) {
+        errorProvider.SetError(tbBlobContainer, "A name is required for the blob container.");
+        e.Cancel = true;
+      } else if (!isValidStorageContainerName(name)) {
+        errorProvider.SetError(tbBlobContainer, "A blob container name must be between 1 and 63 " +
+                                              "characters long, and be composed of lowercase letters, numbers " +
+                                              "and hyphens. Hyphens shouldn't be first or last letter.");
+        e.Cancel = true;
+      } else {
+        errorProvider.SetError(tbBlobContainer, "");
+      }
+    }
+
+    private void cmbChooseHostedService_Validating(object sender, CancelEventArgs e) {
+      if ((!cbNewHostedService.Checked) && (cmbChooseHostedService.SelectedItem == null)) {
+        errorProvider.SetError(cmbChooseHostedService, "A hoste service is required.");
+        e.Cancel = true;
+      } else {
+        errorProvider.SetError(cmbChooseHostedService, "");
+      }
+    }
+
+    private void cmbStorageServices_Validating(object sender, CancelEventArgs e) {
+      if (cmbStorageServices.SelectedItem == null) {
+        errorProvider.SetError(cmbStorageServices, "A storage service is required.");
+        e.Cancel = true;
+      } else {
+        errorProvider.SetError(cmbStorageServices, "");
+      }
+    }
+
+    private class CreateDeploymentData {
+      public Subscription Subscription { get; set; }
+      public bool CreateNewHosteService { get; set; }
+      public bool UseRegion { get; set; }
+      public string CertificateFilePath { get; set; }
+      public string CertificatePassword { get; set; }
+      public HostedService HostedService { get; set; }
+      public int InstanceCount { get; set; }
+      public StorageService StorageService { get; set; }
+      public string BlobContainerName { get; set; }
+      public bool CreateContainerIfNotExists { get; set; }
+    }
   }
 }
