Use ListVirtualMfaDevices with an AWS SDK or CLI - AWS Identity and Access Management

Use ListVirtualMfaDevices with an AWS SDK or CLI

The following code examples show how to use ListVirtualMfaDevices.

CLI
AWS 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 AWS 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 AWS 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 AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.