Esempio n. 1
0
        /// <summary>
        /// Returns private configuration as string
        /// </summary>
        /// <returns></returns>
        protected string GetPrivateConfiguration()
        {
            PrivateKeyVaultCredentialSettings akvPrivateSettings = null;

            if (this.KeyVaultCredentialSettings != null)
            {
                akvPrivateSettings = new PrivateKeyVaultCredentialSettings {
                    AzureKeyVaultUrl       = this.KeyVaultCredentialSettings.AzureKeyVaultUrl,
                    ServicePrincipalName   = this.KeyVaultCredentialSettings.ServicePrincipalName,
                    ServicePrincipalSecret = this.KeyVaultCredentialSettings.ServicePrincipalSecret
                };
            }

            return(JsonUtilities.TryFormatJson(JsonConvert.SerializeObject(
                                                   new SqlServerPrivateSettings
            {
                StorageUrl = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageUrl,
                StorageAccessKey = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageAccessKey,
                Password = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.Password,
                PrivateKeyVaultCredentialSettings = (akvPrivateSettings == null) ? null : akvPrivateSettings
            })));
        }
        /// <summary>
        /// Returns private configuration as string
        /// </summary>
        /// <returns></returns>
        protected string GetPrivateConfiguration()
        {

            PrivateKeyVaultCredentialSettings akvPrivateSettings = null;

            if(this.KeyVaultCredentialSettings != null)
            {
                akvPrivateSettings = new PrivateKeyVaultCredentialSettings { AzureKeyVaultUrl = this.KeyVaultCredentialSettings.AzureKeyVaultUrl, 
                                                                             ServicePrincipalName = this.KeyVaultCredentialSettings.ServicePrincipalName, 
                                                                             ServicePrincipalSecret = this.KeyVaultCredentialSettings.ServicePrincipalSecret 
                                                                           };
            }

            return JsonUtilities.TryFormatJson(JsonConvert.SerializeObject(
                       new SqlServerPrivateSettings
                       {
                           StorageUrl = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageUrl,
                           StorageAccessKey = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageAccessKey,
                           Password = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.Password,
                           PrivateKeyVaultCredentialSettings = (akvPrivateSettings == null) ? null : akvPrivateSettings
                       }));
        }