@@ -529,15 +529,6 @@ public Fixture()
529529 var configuration = TestHelpers . GetTestConfiguration ( ) ;
530530 BlobConnectionString = configuration . GetWebJobsConnectionString ( ConnectionStringNames . Storage ) ;
531531
532- KeyVaultConnectionString = configuration . GetWebJobsConnectionString ( EnvironmentSettingNames . AzureWebJobsSecretStorageKeyVaultConnectionString ) ;
533- KeyVaultName = configuration . GetWebJobsConnectionString ( EnvironmentSettingNames . AzureWebJobsSecretStorageKeyVaultName ) ;
534-
535- if ( KeyVaultConnectionString is not null && KeyVaultName is not null )
536- {
537- AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider ( KeyVaultConnectionString ) ;
538- KeyVaultClient = new KeyVaultClient ( new KeyVaultClient . AuthenticationCallback ( azureServiceTokenProvider . KeyVaultTokenCallback ) ) ;
539- }
540-
541532 Environment = new TestEnvironment ( ) ;
542533 AzureStorageProvider = TestHelpers . GetAzureStorageProvider ( configuration ) ;
543534 }
@@ -554,8 +545,6 @@ public Fixture()
554545
555546 public CloudBlobContainer BlobContainer { get ; private set ; }
556547
557- public KeyVaultClient KeyVaultClient { get ; private set ; }
558-
559548 public string KeyVaultName { get ; private set ; }
560549
561550 public string KeyVaultConnectionString { get ; private set ; }
@@ -588,11 +577,6 @@ public async Task TestInitialize(SecretsRepositoryType repositoryType, string se
588577 await ClearAllBlobSecrets ( ) ;
589578 ClearAllFileSecrets ( ) ;
590579
591- if ( KeyVaultClient != null )
592- {
593- await ClearAllKeyVaultSecrets ( ) ;
594- }
595-
596580 LoggerProvider = new TestLoggerProvider ( ) ;
597581 var loggerFactory = new LoggerFactory ( ) ;
598582 loggerFactory . AddProvider ( LoggerProvider ) ;
@@ -626,7 +610,6 @@ public void Dispose()
626610 // delete blob files
627611 ClearAllBlobSecrets ( ) . ContinueWith ( t => { } ) ;
628612 ClearAllFileSecrets ( ) ;
629- ClearAllKeyVaultSecrets ( ) . ContinueWith ( t => { } ) ;
630613 }
631614 catch
632615 {
@@ -663,9 +646,6 @@ public async Task WriteSecret(string functionNameOrHost, ScriptSecrets scriptSec
663646 case SecretsRepositoryType . BlobStorageSas :
664647 await WriteSecretsBlobAndUpdateSentinelFile ( functionNameOrHost , ScriptSecretSerializer . SerializeSecrets ( scriptSecret ) ) ;
665648 break ;
666- case SecretsRepositoryType . KeyVault :
667- await WriteSecretsKeyVaultAndUpdateSectinelFile ( functionNameOrHost , scriptSecret ) ;
668- break ;
669649 default :
670650 break ;
671651 }
@@ -692,15 +672,6 @@ private async Task WriteSecretsBlobAndUpdateSentinelFile(string functionNameOrHo
692672 }
693673 }
694674
695- private async Task WriteSecretsKeyVaultAndUpdateSectinelFile ( string functionNameOrHost , ScriptSecrets secrets , bool createSentinelFile = true )
696- {
697- Dictionary < string , string > dictionary = KeyVaultSecretsRepository . GetDictionaryFromScriptSecrets ( secrets , functionNameOrHost ) ;
698- foreach ( string key in dictionary . Keys )
699- {
700- await KeyVaultClient . SetSecretAsync ( GetKeyVaultBaseUrl ( ) , key , dictionary [ key ] ) ;
701- }
702- }
703-
704675 public async Task < ScriptSecrets > GetSecretText ( string functionNameOrHost , ScriptSecretsType type )
705676 {
706677 ScriptSecrets secrets = null ;
@@ -714,9 +685,6 @@ public async Task<ScriptSecrets> GetSecretText(string functionNameOrHost, Script
714685 case SecretsRepositoryType . BlobStorageSas :
715686 secrets = await GetSecretBlobText ( functionNameOrHost , type ) ;
716687 break ;
717- case SecretsRepositoryType . KeyVault :
718- secrets = await GetSecretsFromKeyVault ( functionNameOrHost , type ) ;
719- break ;
720688 default :
721689 break ;
722690 }
@@ -734,33 +702,6 @@ private async Task<ScriptSecrets> GetSecretBlobText(string functionNameOrHost, S
734702 return ScriptSecretSerializer . DeserializeSecrets ( type , blobText ) ;
735703 }
736704
737- private async Task < ScriptSecrets > GetSecretsFromKeyVault ( string functionNameOrHost , ScriptSecretsType type )
738- {
739- var secretResults = await KeyVaultClient . GetSecretsAsync ( GetKeyVaultBaseUrl ( ) ) ;
740- if ( type == ScriptSecretsType . Host )
741- {
742- SecretBundle masterBundle = await KeyVaultClient . GetSecretAsync ( GetKeyVaultBaseUrl ( ) , secretResults . FirstOrDefault ( x => x . Identifier . Name . StartsWith ( "host--master" ) ) . Identifier . Name ) ;
743- SecretBundle functionKeyBundle = await KeyVaultClient . GetSecretAsync ( GetKeyVaultBaseUrl ( ) , secretResults . FirstOrDefault ( x => x . Identifier . Name . StartsWith ( "host--functionKey" ) ) . Identifier . Name ) ;
744- SecretBundle systemKeyBundle = await KeyVaultClient . GetSecretAsync ( GetKeyVaultBaseUrl ( ) , secretResults . FirstOrDefault ( x => x . Identifier . Name . StartsWith ( "host--systemKey" ) ) . Identifier . Name ) ;
745- HostSecrets hostSecrets = new HostSecrets ( )
746- {
747- FunctionKeys = new List < Key > ( ) { new Key ( GetSecretName ( functionKeyBundle . SecretIdentifier . Name ) , functionKeyBundle . Value ) } ,
748- SystemKeys = new List < Key > ( ) { new Key ( GetSecretName ( systemKeyBundle . SecretIdentifier . Name ) , systemKeyBundle . Value ) }
749- } ;
750- hostSecrets . MasterKey = new Key ( "master" , masterBundle . Value ) ;
751- return hostSecrets ;
752- }
753- else
754- {
755- SecretBundle functionKeyBundle = await KeyVaultClient . GetSecretAsync ( GetKeyVaultBaseUrl ( ) , secretResults . FirstOrDefault ( x => x . Identifier . Name . StartsWith ( "function--" ) ) . Identifier . Name ) ;
756- FunctionSecrets functionSecrets = new FunctionSecrets ( )
757- {
758- Keys = new List < Key > ( ) { new Key ( GetSecretName ( functionKeyBundle . SecretIdentifier . Name ) , functionKeyBundle . Value ) }
759- } ;
760- return functionSecrets ;
761- }
762- }
763-
764705 public bool MarkerFileExists ( string functionNameOrHost )
765706 {
766707 return File . Exists ( SecretsFileOrSentinelPath ( functionNameOrHost ) ) ;
@@ -800,18 +741,6 @@ private async Task ClearAllBlobSecrets()
800741 await BlobContainer . GetBlockBlobReference ( ( ( CloudBlockBlob ) blob ) . Name ) . DeleteIfExistsAsync ( ) ;
801742 }
802743 }
803-
804- private async Task ClearAllKeyVaultSecrets ( )
805- {
806- var secretsPages = await KeyVaultSecretsRepository . GetKeyVaultSecretsPagesAsync ( KeyVaultClient , GetKeyVaultBaseUrl ( ) ) ;
807- foreach ( IPage < SecretItem > secretsPage in secretsPages )
808- {
809- foreach ( SecretItem item in secretsPage )
810- {
811- await KeyVaultClient . DeleteSecretAsync ( GetKeyVaultBaseUrl ( ) , item . Identifier . Name ) ;
812- }
813- }
814- }
815744 }
816745 }
817746}
0 commit comments