

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Tools for PowerShell V4 を使用した Amazon Cognito ID の例
<a name="powershell_4_cognito-identity_code_examples"></a>

次のコード例は、Amazon Cognito Identity で AWS Tools for PowerShell V4 を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

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

次のコード例は、`Get-CGIIdentityPool` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 特定のアイデンティティプールに関する情報をその ID を用いて取得します。**  

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

```
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
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[DescribeIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Get-CGIIdentityPoolList` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 既存のアイデンティティプールのリストを取得します。**  

```
Get-CGIIdentityPoolList
```
**出力:**  

```
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
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[ListIdentityPools](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Get-CGIIdentityPoolRole` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 特定のアイデンティティプールのロールに関する情報を取得します。**  

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

```
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
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[GetIdentityPoolRoles](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`New-CGIIdentityPool` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 認証されていない ID を許可する新しいアイデンティティプールを作成します。**  

```
New-CGIIdentityPool -AllowUnauthenticatedIdentities $true -IdentityPoolName CommonTests13
```
**出力:**  

```
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
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[CreateIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Remove-CGIIdentityPool` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 特定のアイデンティティプールを削除します。**  

```
Remove-CGIIdentityPool -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
```
+  API の詳細については、AWS Tools for PowerShell コマンドレットリファレンス (V4) の「[DeleteIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。**

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

次のコード例は、`Set-CGIIdentityPoolRole` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: 認証されていない IAM ロールを持つように特定のアイデンティティプールを設定します。**  

```
Set-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 -Role @{ "unauthenticated" = "arn:aws:iam::123456789012:role/CommonTests1Role" }
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[SetIdentityPoolRoles](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Update-CGIIdentityPool` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 1: アイデンティティプールプロパティの一部を更新します。この場合、アイデンティティプールの名前を更新します。**  

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

```
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
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[UpdateIdentityPool](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。