/// <summary> /// /// </summary> /// <param name="keyVaultUrl">the url where the particular Key Vault instance can be accessed. /// This value is not security sensitive and can be stored in a config file by the caller.</param> /// <param name="azureADApplicationId">This identifier (typically a guid) represents an "application" that has been configured on a specific Key Vault. /// This value is not security sensitive and can be stored in a config file by the caller.</param> /// <param name="secretName">The string designating which secret you wish to retrieve (so as to inspect the secret value). /// This value is not security sensitive and can be stored in a config file by the caller.</param> /// <param name="credentialProvider">a class implementing the sample ICredentialProvider interface. The caller provides /// the particular implementation in which they have loaded the UserCredential object they got from somewhere.</param> /// <returns></returns> private async Task <string> GetAzureServiceBusConnectionStringAsync(string keyVaultUrl, string azureADApplicationId, string secretName, ICredentialProvider credentialProvider) { _azureADApplicationId = azureADApplicationId; //Get UserCredential needed to talk to Azure Key Vault to ask for the connection string _userCredential = credentialProvider.GetUserCredential(); KeyVaultClient keyVaultClient = GetKeyVaultClient(); var secret = await keyVaultClient.GetSecretAsync(keyVaultUrl, secretName); string connectionString = secret.Value; return(connectionString); }