public GoogleCloudKeyManagmentTests() { mConfiguration = new ConfigurationBuilder() .AddJsonFile("settings.json") .AddEnvironmentVariables().Build(); var stream = new MemoryStream(); var writer = new StreamWriter(stream); File.WriteAllText("creds.json", System.Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS")); System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "creds.json"); var location = mConfiguration.GetValue <string>("KeyManagment:GoogleKms:Location"); var keyRingName = mConfiguration.GetValue <string>("KeyManagment:GoogleKms:KeyRingName"); var protectionLevel = mConfiguration.GetValue <string>("KeyManagment:GoogleKms:ProtectionLevel"); var projectId = mConfiguration.GetValue <string>("KeyManagment:GoogleKms:ProjectId"); mGoogleCloudKeyManagement = new GoogleCloudKeyManagment( KeyManagementServiceClient.Create(), projectId, keyRingName, location, protectionLevel, "30"); }