Lakshay Kashyap
Lakshay Kashyap

Reputation: 21

Fetch specific Secret value for a specific key in AWS Secrets Manager via Powershell

I am fetching a secret from AWS Secrets Manager, but currently getting a list of all the key-value pairs. I just want secret value for a specific key in return.

Get-SECSecretValue -SecretId "secret-arn" -Select SecretString

I was not able to find any solution on internet sadly.

Upvotes: 1

Views: 3287

Answers (1)

Vikram S
Vikram S

Reputation: 822

You can use the ConvertFrom-Json to parse the json response and then use json object to get the corresponding value.

username = (ConvertFrom-Json -InputObject (Get-SECSecretValue -SecretId secret-arn ).SecretString).username

Upvotes: 0

Related Questions