AWS code-library documentation change
Summary
Added PowerShell V5 examples for DeleteUserPolicy including bulk removal
Security assessment
Demonstrates policy cleanup procedures important for least privilege maintenance but not tied to a specific vulnerability
Diff
diff --git a/code-library/latest/ug/iam_example_iam_DeleteUserPolicy_section.md b/code-library/latest/ug/iam_example_iam_DeleteUserPolicy_section.md index 74ef721c0..27120f030 100644 --- a//code-library/latest/ug/iam_example_iam_DeleteUserPolicy_section.md +++ b//code-library/latest/ug/iam_example_iam_DeleteUserPolicy_section.md @@ -151,0 +152,21 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example deletes the inline policy named`AccessToEC2Policy` that is embedded in the IAM user named `Bob`.** + + + Remove-IAMUserPolicy -PolicyName AccessToEC2Policy -UserName Bob + + +**Example 2: This example finds all of the inline polices that are embedded in the IAM user named`Theresa` and then deletes them.** + + + $inlinepols = Get-IAMUserPolicies -UserName Theresa + foreach ($pol in $inlinepols) { Remove-IAMUserPolicy -PolicyName $pol -UserName Theresa -Force} + + + * For API details, see [DeleteUserPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +