Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use ListVirtualMfaDevices
with an Amazon SDK or command line tool
The following code examples show how to use ListVirtualMfaDevices
.
- CLI
-
- Amazon CLI
-
To list virtual MFA devices
The following list-virtual-mfa-devices
command lists the virtual MFA devices that have been configured for the current account.
aws iam list-virtual-mfa-devices
Output:
{
"VirtualMFADevices": [
{
"SerialNumber": "arn:aws:iam::123456789012:mfa/ExampleMFADevice"
},
{
"SerialNumber": "arn:aws:iam::123456789012:mfa/Fred"
}
]
}
For more information, see Enabling a virtual multi-factor authentication (MFA) device in the Amazon IAM User Guide.
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example retrieves a collection of the virtual MFA devices that are assigned to users in the Amazon account. The User
property of each is an object with details of the IAM user to which the device is assigned.
Get-IAMVirtualMFADevice -AssignmentStatus Assigned
Output:
Base32StringSeed :
EnableDate : 4/13/2015 12:03:42 PM
QRCodePNG :
SerialNumber : arn:aws:iam::123456789012:mfa/David
User : Amazon.IdentityManagement.Model.User
Base32StringSeed :
EnableDate : 4/13/2015 12:06:41 PM
QRCodePNG :
SerialNumber : arn:aws:iam::123456789012:mfa/root-account-mfa-device
User : Amazon.IdentityManagement.Model.User
For a complete list of Amazon SDK developer guides and code examples, see
Using IAM with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.