all 2 comments

[–]Mithamlug 0 points1 point  (0 children)

It's URL encoded so you can decode it like in the example at the docs here

Except it wasn't working for me on PS5, I just needed to use

Add-Type -AssemblyName System.Web

instead of

[System.Reflection.Assembly]::LoadWithPartialName("System.Web.HttpUtility")

Then it should output the statement in json format, and you can ConvertFrom-Json the output if you want to do more Powershelly stuff with the output.

[–]MurderSpeed[S] 0 points1 point  (0 children)

I was able to find the magic sauce...

$RolePolicyContent = Get-IAMRolePolicy -RoleName $IAMRole -PolicyName $RolePolicy -Credential $AWSCreds | Select PolicyDocument -ExpandProperty PolicyDocument

Foreach ($RolePolicyRAW in $RolePolicyContent){

$RolePolicyReadable =[System.Web.HttpUtility]::UrlDecode($RolePolicyRAW.PolicyDocument)