Use ResyncMfaDevice with a CLI
The following code examples show how to use ResyncMfaDevice.
- CLI
-
- AWS CLI
-
To synchronize an MFA device
The following
resync-mfa-deviceexample synchronizes the MFA device that is associated with the IAM userBoband whose ARN isarn:aws:iam::123456789012:mfa/BobsMFADevicewith an authenticator program that provided the two authentication codes.aws iam resync-mfa-device \ --user-nameBob\ --serial-numberarn:aws:iam::210987654321:mfa/BobsMFADevice\ --authentication-code1123456\ --authentication-code2987654This command produces no output.
For more information, see Using multi-factor authentication (MFA) in AWS in the AWS IAM User Guide.
-
For API details, see ResyncMfaDevice
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example synchronizes the MFA device that is associated with the IAM user
Boband whose ARN isarn:aws:iam::123456789012:mfa/bobwith an authenticator program that provided the two authentication codes.Sync-IAMMFADevice -SerialNumber arn:aws:iam::123456789012:mfa/theresa -AuthenticationCode1 123456 -AuthenticationCode2 987654 -UserName BobExample 2: This example synchronizes the IAM MFA device that is associated with the IAM user
Theresawith a physical device that has the serial numberABCD12345678and that provided the two authentication codes.Sync-IAMMFADevice -SerialNumber ABCD12345678 -AuthenticationCode1 123456 -AuthenticationCode2 987654 -UserName Theresa-
For API details, see ResyncMfaDevice in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example synchronizes the MFA device that is associated with the IAM user
Boband whose ARN isarn:aws:iam::123456789012:mfa/bobwith an authenticator program that provided the two authentication codes.Sync-IAMMFADevice -SerialNumber arn:aws:iam::123456789012:mfa/theresa -AuthenticationCode1 123456 -AuthenticationCode2 987654 -UserName BobExample 2: This example synchronizes the IAM MFA device that is associated with the IAM user
Theresawith a physical device that has the serial numberABCD12345678and that provided the two authentication codes.Sync-IAMMFADevice -SerialNumber ABCD12345678 -AuthenticationCode1 123456 -AuthenticationCode2 987654 -UserName Theresa-
For API details, see ResyncMfaDevice in AWS Tools for PowerShell Cmdlet Reference (V5).
-
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.