public PersistentVMRoleContext NewAzureQuickVM(OS os, string name, string serviceName, string imageName, string userName, string password, string locationName, InstanceSize?instanceSize) { NewAzureQuickVMCmdletInfo newAzureQuickVMCmdlet = new NewAzureQuickVMCmdletInfo(os, name, serviceName, imageName, userName, password, locationName, instanceSize); WindowsAzurePowershellCmdlet azurePowershellCmdlet = new WindowsAzurePowershellCmdlet(newAzureQuickVMCmdlet); SubscriptionData currentSubscription; if ((currentSubscription = GetCurrentAzureSubscription()) == null) { ImportAzurePublishSettingsFile(); currentSubscription = GetCurrentAzureSubscription(); } if (string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount)) { StorageServicePropertiesOperationContext storageAccount = NewAzureStorageAccount(Utilities.GetUniqueShortName("storage"), locationName); if (storageAccount != null) { SetAzureSubscription(currentSubscription.SubscriptionName, storageAccount.StorageAccountName); currentSubscription = GetCurrentAzureSubscription(); } } if (!string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount)) { azurePowershellCmdlet.Run(); return(GetAzureVM(name, serviceName)); } return(null); }
public PersistentVMRoleContext NewAzureQuickVM(OS os, string name, string serviceName, string imageName, string password, string locationName) { NewAzureQuickVMCmdletInfo newAzureQuickVMCmdlet = new NewAzureQuickVMCmdletInfo(os, name, serviceName, imageName, password, locationName); WindowsAzurePowershellCmdletSequence sequence = new WindowsAzurePowershellCmdletSequence(); SubscriptionData currentSubscription; if ((currentSubscription = GetCurrentAzureSubscription()) == null) { ImportAzurePublishSettingsFile(); currentSubscription = GetCurrentAzureSubscription(); } if (string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount)) { StorageServicePropertiesOperationContext storageAccount = NewAzureStorageAccount(Utilities.GetUniqueShortName("storage"), locationName); if (storageAccount != null) { SetAzureSubscription(currentSubscription.SubscriptionName, storageAccount.StorageAccountName); currentSubscription = GetCurrentAzureSubscription(); } } if (!string.IsNullOrEmpty(currentSubscription.CurrentStorageAccount)) { sequence.Add(newAzureQuickVMCmdlet); sequence.Run(); return GetAzureVM(name, serviceName); } return null; }