Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
        /// <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;
        }
Ejemplo n.º 4
0
        public void AddEnvironment(WindowsAzureEnvironment newEnvironment)
        {
            if (environments.ContainsKey(newEnvironment.Name))
            {
                throw new InvalidOperationException(string.Format(Resources.EnvironmentExists, newEnvironment.Name));
            }

            environments[newEnvironment.Name] = newEnvironment;

            Save();
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
        /// <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;
        }
Ejemplo n.º 7
0
        /// <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;
        }
Ejemplo n.º 8
0
 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];
         }
     }
 }
Ejemplo n.º 9
0
 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];
         }
     }
 }
Ejemplo n.º 10
0
 /// <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;
 }
Ejemplo n.º 11
0
 public void UpdateEnvironment(WindowsAzureEnvironment newEnvironment)
 {
     GuardEnvironmentExistsAndNonPublic(newEnvironment.Name);
     environments[newEnvironment.Name] = newEnvironment;
     Save();
 }
Ejemplo n.º 12
0
        public void AddEnvironment(WindowsAzureEnvironment newEnvironment)
        {
            if (environments.ContainsKey(newEnvironment.Name))
            {
                throw new InvalidOperationException(string.Format(Resources.EnvironmentExists, newEnvironment.Name));
            }

            environments[newEnvironment.Name] = newEnvironment;

            Save();
        }
Ejemplo n.º 13
0
 public void UpdateEnvironment(WindowsAzureEnvironment newEnvironment)
 {
     GuardEnvironmentExistsAndNonPublic(newEnvironment.Name);
     environments[newEnvironment.Name] = newEnvironment;
     Save();
 }