AWS Security ChangesHomeSearch

AWS code-library high security documentation change

Service: code-library · 2025-06-28 · Security-related high

File: code-library/latest/ug/iam_example_iam_EnableMfaDevice_section.md

Summary

Added PowerShell V5 examples for MFA device setup and activation

Security assessment

Provides concrete examples for implementing MFA, a critical security control. Shows proper enrollment process which helps prevent account compromise.

Diff

diff --git a/code-library/latest/ug/iam_example_iam_EnableMfaDevice_section.md b/code-library/latest/ug/iam_example_iam_EnableMfaDevice_section.md
index 3041f50bb..3682e74e9 100644
--- a//code-library/latest/ug/iam_example_iam_EnableMfaDevice_section.md
+++ b//code-library/latest/ug/iam_example_iam_EnableMfaDevice_section.md
@@ -62,0 +63,22 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This command enables the hardware MFA device with the serial number`987654321098` and associates the device with the user `Bob`. It includes the first two codes in sequence from the device.**
+    
+    
+    Enable-IAMMFADevice -UserName "Bob" -SerialNumber "987654321098" -AuthenticationCode1 "12345678" -AuthenticationCode2 "87654321"
+    
+
+**Example 2: This example creates and enables a virtual MFA device. The first command creates the virtual device and returns the device's object representation in the variable`$MFADevice`. You can use the `.Base32StringSeed` or `QRCodePng` properties to configure the user's software application. The final command assigns the device to the user `David`, identifying the device by its serial number. The command also synchronizes the device with AWS by including the first two codes in sequence from the virtual MFA device.**
+    
+    
+    $MFADevice = New-IAMVirtualMFADevice -VirtualMFADeviceName "MyMFADevice"
+    # see example for New-IAMVirtualMFADevice to see how to configure the software program with PNG or base32 seed code
+    Enable-IAMMFADevice -UserName "David" -SerialNumber -SerialNumber $MFADevice.SerialNumber -AuthenticationCode1 "24681357" -AuthenticationCode2 "13572468"
+    
+
+  * For API details, see [EnableMfaDevice](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+