/// <summary> /// Creates a new credentials instance of type T using the set of /// registered cloud credentials providers and provided settings. /// </summary> /// <typeparam name="T">The requested minimum type of cloud credentials /// for successful credential use.</typeparam> /// <param name="settings">Dictionary of configuration settings.</param> /// <param name="isRequired">Provides a value indicating whether to /// throw if the minimum requested credentials type cannot be found. /// Defaults to true.</param> /// <returns>Returns a new instance of the first provider that supports /// the provided settings.</returns> public static T GetCredentials <T>(IDictionary <string, object> settings, bool isRequired = true) where T : CloudCredentials { T credentials = CloudConfiguration.CreateCloudCredentials <T>(settings); if (credentials == null && isRequired) { throw new InvalidOperationException( string.Format( CultureInfo.InvariantCulture, Properties.Resources.ConfigurationHelper_GetCredentials_NotFound, typeof(T).Name)); } return(credentials); }