AWS Security ChangesHomeSearch

AWS IAM documentation change

Service: IAM · 2025-06-25 · Documentation medium

File: IAM/latest/UserGuide/iam_example_iam_CreateRole_section.md

Summary

Added PowerShell V5 example for role creation with trust policy

Security assessment

Shows secure role configuration with assume-role policy but doesn't address a specific security issue

Diff

diff --git a/IAM/latest/UserGuide/iam_example_iam_CreateRole_section.md b/IAM/latest/UserGuide/iam_example_iam_CreateRole_section.md
index dc78ad2e5..3a5217550 100644
--- a//IAM/latest/UserGuide/iam_example_iam_CreateRole_section.md
+++ b//IAM/latest/UserGuide/iam_example_iam_CreateRole_section.md
@@ -643,0 +644,47 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This example creates a new role named`MyNewRole` and attaches to it the policy found in the file `NewRoleTrustPolicy.json`. Note that you must use the `-Raw` switch parameter to successfully process the JSON policy file. The policy document displayed in the output is URL encoded. It is decoded in this example with the `UrlDecode` .NET method. **
+    
+    
+    $results = New-IAMRole -AssumeRolePolicyDocument (Get-Content -raw NewRoleTrustPolicy.json) -RoleName MyNewRole
+    $results
+    
+
+**Output:**
+    
+    
+    Arn                      : arn:aws:iam::123456789012:role/MyNewRole
+    AssumeRolePolicyDocument : %7B%0D%0A%20%20%22Version%22%3A%20%222012-10-17%22%2C%0D%0A%20%20%22Statement%22
+                               %3A%20%5B%0D%0A%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%22Sid%22%3A%20%22%22%2C
+                               %0D%0A%20%20%20%20%20%20%22Effect%22%3A%20%22Allow%22%2C%0D%0A%20%20%20%20%20%20
+                               %22Principal%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22AWS%22%3A%20%22arn%3Aaws
+                               %3Aiam%3A%3A123456789012%3ADavid%22%0D%0A%20%20%20%20%20%20%7D%2C%0D%0A%20%20%20
+                               %20%20%20%22Action%22%3A%20%22sts%3AAssumeRole%22%0D%0A%20%20%20%20%7D%0D%0A%20
+                               %20%5D%0D%0A%7D
+    CreateDate               : 4/15/2015 11:04:23 AM
+    Path                     : /
+    RoleId                   : V5PAJI2KPN4EAEXAMPLE1
+    RoleName                 : MyNewRole
+    
+    [System.Reflection.Assembly]::LoadWithPartialName("System.Web.HttpUtility")
+    [System.Web.HttpUtility]::UrlDecode($results.AssumeRolePolicyDocument)
+    {
+      "Version": "2012-10-17",
+      "Statement": [
+        {
+          "Sid": "",
+          "Effect": "Allow",
+          "Principal": {
+            "AWS": "arn:aws:iam::123456789012:David"
+          },
+          "Action": "sts:AssumeRole"
+        }
+      ]
+    }
+
+  * For API details, see [CreateRole](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+