

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh [SDK AWS Doc](https://github.com/awsdocs/aws-doc-sdk-examples). GitHub 

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Contoh Identitas Amazon Cognito menggunakan Alat untuk V4 PowerShell
<a name="powershell_4_cognito-identity_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan Alat AWS untuk PowerShell V4 dengan Identitas Amazon Cognito.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `Get-CGIIdentityPool`
<a name="cognito-identity_DescribeIdentityPool_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-CGIIdentityPool`.

**Alat untuk PowerShell V4**  
**Contoh 1: Mengambil informasi tentang Identity Pool tertentu dengan idnya.**  

```
Get-CGIIdentityPool -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
```
**Output:**  

```
LoggedAt                       : 8/12/2015 4:29:40 PM
AllowUnauthenticatedIdentities : True
DeveloperProviderName          :
IdentityPoolId                 : us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
IdentityPoolName               : CommonTests1
OpenIdConnectProviderARNs      : {}
SupportedLoginProviders        : {}
ResponseMetadata               : Amazon.Runtime.ResponseMetadata
ContentLength                  : 142
HttpStatusCode                 : OK
```
+  Untuk detail API, lihat [DescribeIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-CGIIdentityPoolList`
<a name="cognito-identity_ListIdentityPools_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-CGIIdentityPoolList`.

**Alat untuk PowerShell V4**  
**Contoh 1: Mengambil daftar Identity Pools yang ada.**  

```
Get-CGIIdentityPoolList
```
**Output:**  

```
IdentityPoolId                                                     IdentityPoolName
--------------                                                     ----------------
us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1                     CommonTests1
us-east-1:118d242d-204e-4b88-b803-EXAMPLEGUID2                     Tests2
us-east-1:15d49393-ab16-431a-b26e-EXAMPLEGUID3                     CommonTests13
```
+  Untuk detail API, lihat [ListIdentityPools](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-CGIIdentityPoolRole`
<a name="cognito-identity_GetIdentityPoolRoles_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-CGIIdentityPoolRole`.

**Alat untuk PowerShell V4**  
**Contoh 1: Mendapatkan informasi tentang peran untuk Identity Pool tertentu.**  

```
Get-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
```
**Output:**  

```
LoggedAt         : 8/12/2015 4:33:51 PM
IdentityPoolId   : us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
Roles            : {[unauthenticated, arn:aws:iam::123456789012:role/CommonTests1Role]}
ResponseMetadata : Amazon.Runtime.ResponseMetadata
ContentLength    : 165
HttpStatusCode   : OK
```
+  Untuk detail API, lihat [GetIdentityPoolRoles](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-CGIIdentityPool`
<a name="cognito-identity_CreateIdentityPool_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-CGIIdentityPool`.

**Alat untuk PowerShell V4**  
**Contoh 1: Membuat Identity Pool baru yang memungkinkan identitas yang tidak diautentikasi.**  

```
New-CGIIdentityPool -AllowUnauthenticatedIdentities $true -IdentityPoolName CommonTests13
```
**Output:**  

```
LoggedAt                       : 8/12/2015 4:56:07 PM
AllowUnauthenticatedIdentities : True
DeveloperProviderName          :
IdentityPoolId                 : us-east-1:15d49393-ab16-431a-b26e-EXAMPLEGUID3
IdentityPoolName               : CommonTests13
OpenIdConnectProviderARNs      : {}
SupportedLoginProviders        : {}
ResponseMetadata               : Amazon.Runtime.ResponseMetadata
ContentLength                  : 136
HttpStatusCode                 : OK
```
+  Untuk detail API, lihat [CreateIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-CGIIdentityPool`
<a name="cognito-identity_DeleteIdentityPool_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-CGIIdentityPool`.

**Alat untuk PowerShell V4**  
**Contoh 1: Menghapus Identity Pool tertentu.**  

```
Remove-CGIIdentityPool -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
```
+  Untuk detail API, lihat [DeleteIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Set-CGIIdentityPoolRole`
<a name="cognito-identity_SetIdentityPoolRoles_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Set-CGIIdentityPoolRole`.

**Alat untuk PowerShell V4**  
**Contoh 1: Mengkonfigurasi Identity Pool tertentu untuk memiliki peran IAM yang tidak diautentikasi.**  

```
Set-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 -Role @{ "unauthenticated" = "arn:aws:iam::123456789012:role/CommonTests1Role" }
```
+  Untuk detail API, lihat [SetIdentityPoolRoles](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Update-CGIIdentityPool`
<a name="cognito-identity_UpdateIdentityPool_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Update-CGIIdentityPool`.

**Alat untuk PowerShell V4**  
**Contoh 1: Memperbarui beberapa properti Identity Pool, dalam hal ini nama Identity Pool.**  

```
Update-CGIIdentityPool -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 -IdentityPoolName NewPoolName
```
**Output:**  

```
LoggedAt                       : 8/12/2015 4:53:33 PM
AllowUnauthenticatedIdentities : False
DeveloperProviderName          :
IdentityPoolId                 : us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
IdentityPoolName               : NewPoolName
OpenIdConnectProviderARNs      : {}
SupportedLoginProviders        : {}
ResponseMetadata               : Amazon.Runtime.ResponseMetadata
ContentLength                  : 135
HttpStatusCode                 : OK
```
+  Untuk detail API, lihat [UpdateIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 