There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListVirtualMfaDevices
with a 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.
-
For API details, see ListVirtualMfaDevices
in AWS CLI Command Reference.
-
- 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 API details, see ListVirtualMfaDevices in AWS Tools for PowerShell Cmdlet Reference.
-