Use DeactivateMfaDevice with an Amazon SDK or command line tool - Amazon Identity and Access Management
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 DeactivateMfaDevice with an Amazon SDK or command line tool

The following code examples show how to use DeactivateMfaDevice.

CLI
Amazon CLI

To deactivate an MFA device

This command deactivates the virtual MFA device with the ARN arn:aws:iam::210987654321:mfa/BobsMFADevice that is associated with the user Bob.

aws iam deactivate-mfa-device \ --user-name Bob \ --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice

This command produces no output.

For more information, see Using multi-factor authentication (MFA) in Amazon in the Amazon IAM User Guide.

PowerShell
Tools for PowerShell

Example 1: This command disables the hardware MFA device associated with the user Bob that has the serial number 123456789012.

Disable-IAMMFADevice -UserName "Bob" -SerialNumber "123456789012"

Example 2: This command disables the virtual MFA device associated with the user David that has the ARN arn:aws:iam::210987654321:mfa/David. Note that virtual MFA device is not deleted from the account. The virtual device is still present and appears in the output of the Get-IAMVirtualMFADevice command. Before you can create a new virtual MFA device for the same user, you must delete the old one by using the Remove-IAMVirtualMFADevice command.

Disable-IAMMFADevice -UserName "David" -SerialNumber "arn:aws:iam::210987654321:mfa/David"

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.