AWS code-library documentation change
Summary
Added PowerShell V5 example demonstrating policy version retrieval and URL decoding
Security assessment
Shows inspection of IAM policy versions, which is security-relevant, but doesn't address vulnerabilities. The documentation improvement helps users audit policies but doesn't introduce new security controls.
Diff
diff --git a/code-library/latest/ug/iam_example_iam_GetPolicyVersion_section.md b/code-library/latest/ug/iam_example_iam_GetPolicyVersion_section.md index b8c359955..f7aa1b416 100644 --- a//code-library/latest/ug/iam_example_iam_GetPolicyVersion_section.md +++ b//code-library/latest/ug/iam_example_iam_GetPolicyVersion_section.md @@ -98,0 +99,35 @@ PowerShell + + + +**Tools for PowerShell V5** + + +**Example 1: This example returns the policy document for the`v2` version of the policy whose ARN is `arn:aws:iam::123456789012:policy/MyManagedPolicy`. The policy document in the `Document` property is URL encoded and is decoded in this example with the `UrlDecode` .NET method.** + + + $results = Get-IAMPolicyVersion -PolicyArn arn:aws:iam::123456789012:policy/MyManagedPolicy -VersionId v2 + $results + + +**Output:** + + + CreateDate Document IsDefaultVersion VersionId + ---------- -------- ---------------- --------- + 2/12/2015 9:39:53 AM %7B%0A%20%20%22Version%22%3A%20%222012-10... True v2 + + [System.Reflection.Assembly]::LoadWithPartialName("System.Web.HttpUtility") + $policy = [System.Web.HttpUtility]::UrlDecode($results.Document) + $policy + { + "Version": "2012-10-17", + "Statement": + { + "Effect": "Allow", + "Action": "*", + "Resource": "*" + } + } + + * For API details, see [GetPolicyVersion](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. +