

# CLI로 `EnableMfaDevice` 사용
<a name="iam_example_iam_EnableMfaDevice_section"></a>

다음 코드 예시는 `EnableMfaDevice`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**MFA 디바이스 활성화**  
`create-virtual-mfa-device` 명령을 사용하여 새 가상 MFA 디바이스를 생성한 후 사용자에게 MFA 디바이스를 할당할 수 있습니다. 다음 `enable-mfa-device` 예제는 일련 번호가 `arn:aws:iam::210987654321:mfa/BobsMFADevice`인 MFA 디바이스를 사용자 `Bob`에게 할당합니다. 또한 이 명령은 가상 MFA 디바이스의 처음 두 코드를 순서대로 포함하여 디바이스를 AWS와 동기화합니다.  

```
aws iam enable-mfa-device \
    --user-name Bob \
    --serial-number arn:aws:iam::210987654321:mfa/BobsMFADevice \
    --authentication-code1 123456 \
    --authentication-code2 789012
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 **AWS IAM 사용 설명서의 [가상 다중 인증(MFA) 디바이스 활성화](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html)를 참조하세요.  
+  API 세부 정보는 **AWS CLI 명령 참조의 [EnableMfaDevice](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iam/enable-mfa-device.html)를 참조하세요.

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**예제 1: 이 명령은 일련 번호 `987654321098`을 사용하여 하드웨어 MFA 디바이스를 활성화하고 디바이스를 사용자 `Bob`과 연결합니다. 여기에는 디바이스의 처음 두 코드가 순서대로 포함됩니다.**  

```
Enable-IAMMFADevice -UserName "Bob" -SerialNumber "987654321098" -AuthenticationCode1 "12345678" -AuthenticationCode2 "87654321"
```
**예제 2: 이 예제는 가상 MFA 디바이스를 생성하고 활성화합니다. 첫 번째 명령은 가상 디바이스를 생성하고 `$MFADevice` 변수에 디바이스의 객체 표현을 반환합니다. `.Base32StringSeed` 또는 `QRCodePng` 속성을 사용하여 사용자의 소프트웨어 애플리케이션을 구성할 수 있습니다. 마지막 명령은 사용자 `David`에게 디바이스를 할당하고 일련 번호로 디바이스를 식별합니다. 또한 이 명령은 가상 MFA 디바이스의 처음 두 코드를 순서대로 포함하여 디바이스를 AWS와 동기화합니다.**  

```
$MFADevice = New-IAMVirtualMFADevice -VirtualMFADeviceName "MyMFADevice"
# see example for New-IAMVirtualMFADevice to see how to configure the software program with PNG or base32 seed code
Enable-IAMMFADevice -UserName "David" -SerialNumber -SerialNumber $MFADevice.SerialNumber -AuthenticationCode1 "24681357" -AuthenticationCode2 "13572468"
```
+  API 세부 정보는 **AWS Tools for PowerShell Cmdlet 참조(V4)의 [EnableMfaDevice](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for PowerShell V5**  
**예제 1: 이 명령은 일련 번호 `987654321098`을 사용하여 하드웨어 MFA 디바이스를 활성화하고 디바이스를 사용자 `Bob`과 연결합니다. 여기에는 디바이스의 처음 두 코드가 순서대로 포함됩니다.**  

```
Enable-IAMMFADevice -UserName "Bob" -SerialNumber "987654321098" -AuthenticationCode1 "12345678" -AuthenticationCode2 "87654321"
```
**예제 2: 이 예제는 가상 MFA 디바이스를 생성하고 활성화합니다. 첫 번째 명령은 가상 디바이스를 생성하고 `$MFADevice` 변수에 디바이스의 객체 표현을 반환합니다. `.Base32StringSeed` 또는 `QRCodePng` 속성을 사용하여 사용자의 소프트웨어 애플리케이션을 구성할 수 있습니다. 마지막 명령은 사용자 `David`에게 디바이스를 할당하고 일련 번호로 디바이스를 식별합니다. 또한 이 명령은 가상 MFA 디바이스의 처음 두 코드를 순서대로 포함하여 디바이스를 AWS와 동기화합니다.**  

```
$MFADevice = New-IAMVirtualMFADevice -VirtualMFADeviceName "MyMFADevice"
# see example for New-IAMVirtualMFADevice to see how to configure the software program with PNG or base32 seed code
Enable-IAMMFADevice -UserName "David" -SerialNumber -SerialNumber $MFADevice.SerialNumber -AuthenticationCode1 "24681357" -AuthenticationCode2 "13572468"
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V5)*의 [EnableMfaDevice](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------

AWS SDK 개발자 가이드 및 코드 예제의 전체 목록은 [AWS SDK와 함께 이 서비스 사용](sdk-general-information-section.md)을 참조하세요. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.