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; }
public Collection<OSImageContext> GetAzureVMImage(string imageName = null) { GetAzureVMImageCmdletInfo getAzureVMImageCmdlet = new GetAzureVMImageCmdletInfo(imageName); WindowsAzurePowershellCmdletSequence azurePowershellCmdlet = new WindowsAzurePowershellCmdletSequence(); azurePowershellCmdlet.Add(getAzureVMImageCmdlet); Collection<OSImageContext> osImageContext = new Collection<OSImageContext>(); foreach (PSObject result in azurePowershellCmdlet.Run()) { osImageContext.Add((OSImageContext)result.BaseObject); } return osImageContext; }