static void Main(string[] args)
 {
     Options options = new Options();
     if (CommandLine.Parser.Default.ParseArguments(args, options))
     {
         ConsoleColor oldColor = Console.ForegroundColor;
         try
         {
             AsyncContext.Run(() => AsyncMain(options));
         }
         catch (ConsoleAppException ex)
         {
             Console.WriteLine(ex.Message);
         }
         finally
         {
             Console.ForegroundColor = oldColor;
         }
     }
 }
        private static async Task AsyncMain(Options options)
        {
            if (!File.Exists(options.Configuration))
            {
                throw new ConsoleAppException("Configuration file does not exist");
            }

            IDependencyResolver dependencyResolver = new UnityApplicationFrameworkDependencyResolver(new UnityContainer());
            dependencyResolver.UseCore().UseAzure();

            string[] settingsFiles = options.Settings.Split(',');

            ApplicationConfigurationSettings settings = ApplicationConfigurationSettings.FromFiles(settingsFiles);
            ApplicationConfiguration configuration = await ApplicationConfiguration.FromFileAsync(options.Configuration, settings, false);

            IKeyVaultFactory keyVaultFactory = dependencyResolver.Resolve<IKeyVaultFactory>();
            IKeyVault keyVault = keyVaultFactory.Create(options.KeyVaultClientId, options.KeyVaultClientKey, options.KeyVaultUri);
            IKeyVaultConfigurationKeyEncoder encoder = dependencyResolver.Resolve<IKeyVaultConfigurationKeyEncoder>();

            await SetSecrets(configuration, keyVault, encoder, options.Verbose);
        }