I am storing my database password into the Secret value field in the aws secret manager. How do I retrieve the secret value out if I am using the following code?
Secret Key defined in secret key manager: Keykey
Secret value defined in secret key manager : dbPwd
GetSecretValueResponse response = null;
response = client.GetSecretValueAsync(request).Result;
LogWriter.IEConnectLogEvent("GetSecretAsync : " + response.SecretString, "GetSecretAsync");
The above will give me this value : {"Keykey" :"dbPwd"} when I write into a log file. May I know how do I extract the dbPwd out ? Thank you.
2
Answers
I am defining my connectionstring in the web.config.
However as my program is using SqlCacheDependency as shown below . How do I set the connectionString in the SqlCacheDependency? I am thinking of getting the connectionString out first and do a replace with @Password@ with my AWS Key Manager Key value.
Since you receive a JSON value back from the secret manager, you can use a JSON deserializer to retrieve the key value.
Option 1:
Option 2: