Created
June 26, 2017 07:38
-
-
Save bashtoni/1c7a542a97b7c9bb178b4645ac0de38e to your computer and use it in GitHub Desktop.
Remove MFA for a user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -n $1 ]; then | |
echo "Usage: $0 <username>" | |
fi | |
for mfaserial in $(aws iam list-mfa-devices --user-name $user --query MFADevices[].SerialNumber --output text); do | |
aws iam deactivate-mfa-device --serial-number $mfaserial --user-name $user | |
aws iam delete-virtual-mfa-device --serial-number $mfaserial | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment