/// <summary> /// Log in to the given environment, and download and add subscriptions /// for the given account in that environment. /// </summary> /// <param name="environment">environment that the subscription is in.</param> public string AddAccounts(WindowsAzureEnvironment environment) { environment = environment ?? CurrentEnvironment; var newSubscriptions = environment.AddAccount(TokenProvider).ToList(); AddSubscriptions(newSubscriptions); Save(); return(newSubscriptions[0].ActiveDirectoryUserId); }
/// <summary> /// Helper constructor for converting from in memory object /// to serializable one. /// </summary> /// <param name="inMemoryEnvironment">Environment to serialize data from.</param> public AzureEnvironmentData(WindowsAzureEnvironment inMemoryEnvironment) { Name = inMemoryEnvironment.Name; PublishSettingsFileUrl = inMemoryEnvironment.PublishSettingsFileUrl; ServiceEndpoint = inMemoryEnvironment.ServiceEndpoint; ManagementPortalUrl = inMemoryEnvironment.ManagementPortalUrl; StorageEndpointSuffix = inMemoryEnvironment.StorageEndpointSuffix; AdTenantUrl = inMemoryEnvironment.ActiveDirectoryEndpoint; CommonTenantId = inMemoryEnvironment.ActiveDirectoryCommonTenantId; }
public void AddEnvironment(WindowsAzureEnvironment newEnvironment) { if (environments.ContainsKey(newEnvironment.Name)) { throw new InvalidOperationException(string.Format(Resources.EnvironmentExists, newEnvironment.Name)); } environments[newEnvironment.Name] = newEnvironment; Save(); }
private void MigrateExistingEnvironments(string environmentName) { WindowsAzureEnvironment azureEnvironment = environments[environmentName]; if (string.IsNullOrEmpty(azureEnvironment.ResourceManagerEndpoint)) { azureEnvironment.ResourceManagerEndpoint = environments[EnvironmentName.AzureCloud].ResourceManagerEndpoint; } if (string.IsNullOrEmpty(azureEnvironment.GalleryEndpoint)) { azureEnvironment.GalleryEndpoint = environments[EnvironmentName.AzureCloud].GalleryEndpoint; } }
/// <summary> /// Helper constructor for converting from in memory object /// to serializable one. /// </summary> /// <param name="inMemoryEnvironment">Environment to serialize data from.</param> public AzureEnvironmentData(WindowsAzureEnvironment inMemoryEnvironment) { Name = inMemoryEnvironment.Name; PublishSettingsFileUrl = inMemoryEnvironment.PublishSettingsFileUrl; ServiceEndpoint = inMemoryEnvironment.ServiceEndpoint; ResourceManagerEndpoint = inMemoryEnvironment.ResourceManagerEndpoint; ManagementPortalUrl = inMemoryEnvironment.ManagementPortalUrl; StorageEndpointSuffix = inMemoryEnvironment.StorageEndpointSuffix; AdTenantUrl = inMemoryEnvironment.ActiveDirectoryEndpoint; CommonTenantId = inMemoryEnvironment.ActiveDirectoryCommonTenantId; GalleryEndpoint = inMemoryEnvironment.GalleryEndpoint; ActiveDirectoryServiceEndpointResourceId = inMemoryEnvironment.ActiveDirectoryServiceEndpointResourceId; SqlDatabaseDnsSuffix = inMemoryEnvironment.SqlDatabaseDnsSuffix ?? WindowsAzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix; }
private void LoadEnvironmentData(ProfileData data) { if (data.Environments != null) { foreach (var e in data.Environments.Select(e => e.ToAzureEnvironment())) { environments[e.Name] = e; } if (environments.ContainsKey(data.DefaultEnvironmentName)) { currentEnvironment = environments[data.DefaultEnvironmentName]; } } }
private void LoadEnvironmentData(ProfileData data) { if (data.Environments != null) { foreach (var e in data.Environments.Select(e => e.ToAzureEnvironment())) { environments[e.Name] = e; MigrateExistingEnvironments(e.Name); } if (environments.ContainsKey(data.DefaultEnvironmentName)) { currentEnvironment = environments[data.DefaultEnvironmentName]; } } }
/// <summary> /// Log in to the given environment, and download and add subscriptions /// for the given account in that environment. /// </summary> /// <param name="environment">environment that the subscription is in.</param> /// <param name="credential">optional credentials</param> public string AddAccounts(WindowsAzureEnvironment environment, PSCredential credential) { environment = environment ?? CurrentEnvironment; var newSubscriptions = environment.AddAccount(TokenProvider, credential).ToList(); AddSubscriptions(newSubscriptions); Save(); return newSubscriptions[0].ActiveDirectoryUserId; }
public void UpdateEnvironment(WindowsAzureEnvironment newEnvironment) { GuardEnvironmentExistsAndNonPublic(newEnvironment.Name); environments[newEnvironment.Name] = newEnvironment; Save(); }