How to Enable a Virtual MFA Device for an IAM User
Last updated: November 24, 2026
Some reviews need Astra to sign in to the AWS Management Console as an IAM user. When you share console credentials in Astra, you can also add the user's MFA setup key, so Astra can generate the codes the login asks for. This article explains how to add a virtual MFA device to an IAM user in AWS.
Before you start
Access to the AWS Management Console with permission to manage IAM users.
An authenticator app, such as Google Authenticator, Authy or Microsoft Authenticator, on a device you have with you. Setup asks for two codes from the app in a row, so you can't finish it without the device.
Add a virtual MFA device
Sign in to the IAM console.
In the left pane, click Users, and then click the user's name.
Open the Security credentials tab. Under Multi-factor authentication (MFA), click Assign MFA device.
Enter a Device name, select Authenticator app, and click Next.
Link the app in one of two ways:
Click Show QR code and scan it with the app.
Click Show secret key and type it into the app.
Enter the current code from the app in MFA code 1. Wait for the next code, which takes up to 30 seconds, and enter it in MFA code 2.
Click Add MFA.
The user is now asked for a one-time code at each console sign-in. For more detail, see AWS's guide to assigning a virtual MFA device.
Share the MFA key with Astra
If Astra needs to sign in as this user, copy the secret key from step 5 before you finish. Then enter it in MFA Setup Key (Optional) on the target's User Credentials step in Astra, along with the user's email or username and password. Read more in 📄 How-To: Creating a Security Auditor Role in AWS.

The User Credentials step of an AWS cloud target, with the Account ID, the console credentials and the MFA Setup Key (Optional) field.
Troubleshooting
The device was added but codes are rejected. The two codes were submitted too long after they were generated, and the device is out of sync. Resync it from the same Security credentials tab. See AWS's guide to resyncing MFA devices.
The QR code won't scan. Click Show secret key and type the key into the app instead.
The app shows no codes, or the codes don't work. Check that the device's clock is set automatically. Codes depend on the device and AWS having the same time.
If you need help with access for a cloud review, contact support from your Astra dashboard or reach out to your CSM.