/// <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); }
/// <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(); }
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)); }
/// <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); }