Пример #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);
        }
Пример #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;
        }
Пример #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;
        }
Пример #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();
        }
Пример #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;
            }
        }
Пример #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;
        }
Пример #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;
        }
Пример #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];
         }
     }
 }
Пример #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];
         }
     }
 }
Пример #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;
 }
Пример #11
0
 public void UpdateEnvironment(WindowsAzureEnvironment newEnvironment)
 {
     GuardEnvironmentExistsAndNonPublic(newEnvironment.Name);
     environments[newEnvironment.Name] = newEnvironment;
     Save();
 }
Пример #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();
        }
Пример #13
0
 public void UpdateEnvironment(WindowsAzureEnvironment newEnvironment)
 {
     GuardEnvironmentExistsAndNonPublic(newEnvironment.Name);
     environments[newEnvironment.Name] = newEnvironment;
     Save();
 }