This class encapsulates the details of creating and reloading certificates from various sources.
Example #1
0
        /// <summary>
        /// Helper method to convert to an in memory subscription object.
        /// </summary>
        /// <returns>The in memory subscription</returns>
        public WindowsAzureSubscription ToAzureSubscription()
        {
            var result = new WindowsAzureSubscription
            {
                SubscriptionName        = this.Name,
                SubscriptionId          = this.SubscriptionId,
                ServiceEndpoint         = !string.IsNullOrEmpty(ManagementEndpoint) ? new Uri(ManagementEndpoint) : null,
                ResourceManagerEndpoint = !string.IsNullOrEmpty(ResourceManagerEndpoint) ? new Uri(ResourceManagerEndpoint) : null,
                ActiveDirectoryEndpoint = ActiveDirectoryEndpoint,
                ActiveDirectoryTenantId = ActiveDirectoryTenantId,
                ActiveDirectoryUserId   = ActiveDirectoryUserId,
                ActiveDirectoryServiceEndpointResourceId = ActiveDirectoryServiceEndpointResourceId,
                IsDefault   = this.IsDefault,
                Certificate = !string.IsNullOrEmpty(ManagementCertificate) ? WindowsAzureCertificate.FromThumbprint(ManagementCertificate) : null,
                CurrentStorageAccountName = CloudStorageAccount,
                GalleryEndpoint           = !string.IsNullOrEmpty(GalleryEndpoint) ? new Uri(GalleryEndpoint) : null,
                SqlDatabaseDnsSuffix      = SqlDatabaseDnsSuffix ?? WindowsAzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix,
            };

            RegisteredResourceProviders = RegisteredResourceProviders ?? new string[0];
            foreach (var resource in RegisteredResourceProviders)
            {
                result.RegisteredResourceProviders.Add(resource);
            }
            return(result);
        }
Example #2
0
 /// <summary>
 /// Destroy any saved data. Deletes the data store and removes any
 /// certificates from the certificate store.
 /// </summary>
 public void DestroyData()
 {
     foreach (var s in subscriptions)
     {
         if (s != null)
         {
             WindowsAzureCertificate.DeleteFromStore(s.Certificate);
         }
     }
     profileStore.DestroyData();
 }
Example #3
0
        private static X509Certificate2 GetCertificate(PublishDataPublishProfile profile,
                                                       PublishDataPublishProfileSubscription s)
        {
            string certificateString;

            if (!string.IsNullOrEmpty(s.ManagementCertificate))
            {
                certificateString = s.ManagementCertificate;
            }
            else
            {
                certificateString = profile.ManagementCertificate;
            }
            return(WindowsAzureCertificate.FromPublishSettingsString(certificateString));
        }
Example #4
0
        /// <summary>
        /// Helper method to convert to an in memory subscription object.
        /// </summary>
        /// <returns>The in memory subscription</returns>
        public WindowsAzureSubscription ToAzureSubscription()
        {
            var result = new WindowsAzureSubscription
            {
                SubscriptionName        = this.Name,
                SubscriptionId          = this.SubscriptionId,
                ServiceEndpoint         = new Uri(ManagementEndpoint),
                ActiveDirectoryEndpoint = ActiveDirectoryEndpoint,
                ActiveDirectoryTenantId = ActiveDirectoryTenantId,
                ActiveDirectoryUserId   = ActiveDirectoryUserId,
                IsDefault   = this.IsDefault,
                Certificate = !string.IsNullOrEmpty(ManagementCertificate) ? WindowsAzureCertificate.FromThumbprint(ManagementCertificate) : null,
                CurrentStorageAccountName = CloudStorageAccount
            };

            RegisteredResourceProviders = RegisteredResourceProviders ?? new string[0];
            foreach (var resource in RegisteredResourceProviders)
            {
                result.RegisteredResourceProviders.Add(resource);
            }
            return(result);
        }