I’ve had a look online and haven’t quite found something that can help me.
I know I want to do something like this:
$j = output of my aws session credentials | ConvertFrom-Json
Write-Host "Acccess Key ID:" $j.AccessKeyId
Write-Host "Secret Acccess Key:" $j.SecretAccessKey
Write-Host "Session Token:" $j.SessionToken
But the problem I have is that my Aws session credentials isn’t clean, it looks like this:
DTS Request ID: hdhdhsbshdhdbsuxbd
{
“Accesskeyid” : “Juddn48373hdhdhd”,
“SecretAccessKey” : “bshdbsb//273!nshdbsb”,
“SessionToken” : “bsbdbdhdhxbche7373738nxjdj/////bdhdhdbxjdn83!!jsjdjs+/////jdhdhdbsbxhdj”,
“TokenExpiration” : “date goes here”
“Packedpolicysize” :86
}
So I figure if I can skip the first row, then I can use ConvertFrom-Json to pick up the keys I need and store them as environment variables.
How can I skip the first row to do this?
Is this the best way, or is there a better approach?
Thanks in advance!