

のバージョン 5 (V5) AWS Tools for PowerShell がリリースされました。

重要な変更とアプリケーションの移行については、[「移行トピック](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)」を参照してください。

 [https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)

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

# AWS Config Tools for PowerShell V5 を使用した の例
<a name="powershell_config-service_code_examples"></a>

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

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

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

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

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

### `Add-CFGResourceTag`
<a name="config-service_TagResource_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定タグをリソース ARN に関連付けます。この場合、リソース ARN は config-rule/config-rule-16iyn0 です。**  

```
Add-CFGResourceTag -ResourceArn arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-16iyn0 -Tag @{Key="Release";Value="Beta"}
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[TagResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateComplianceByConfigRuleList`
<a name="config-service_DescribeAggregateComplianceByConfigRules_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定の設定ルールの詳細を ConfigurationAggregatorの「kaju」フィルタリングから取得して、ルールの「コンプライアンス」を展開/返します。**  

```
Get-CFGAggregateComplianceByConfigRuleList -ConfigurationAggregatorName kaju -Filters_ConfigRuleName ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK | Select-Object -ExpandProperty Compliance
```
**出力:**  

```
ComplianceContributorCount                            ComplianceType
--------------------------                            --------------
Amazon.ConfigService.Model.ComplianceContributorCount NON_COMPLIANT
```
**例 2: この例では、指定の ConfigurationAggregator から詳細を取得し、アグリゲータの対象となるすべてのリージョンの指定アカウントに対してフィルタリングして、さらにすべてのルールのコンプライアンスを返します。**  

```
Get-CFGAggregateComplianceByConfigRuleList -ConfigurationAggregatorName kaju -Filters_AccountId 123456789012 | Select-Object ConfigRuleName, @{N="Compliance";E={$_.Compliance.ComplianceType}}
```
**出力:**  

```
ConfigRuleName                      Compliance
--------------                      ----------
ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK NON_COMPLIANT
ec2-instance-no-public-ip           NON_COMPLIANT
desired-instance-type               NON_COMPLIANT
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeAggregateComplianceByConfigRules](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateComplianceDetailsByConfigRule`
<a name="config-service_GetAggregateComplianceDetailsByConfigRule_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、特定のアカウント、アグリゲータ、リージョン、および設定ルールの「COMPLIANT」状態にある AWS Config ルールdesired-instance-type」の resource-id と resource-type の出力を選択する評価結果を返します。**  

```
Get-CFGAggregateComplianceDetailsByConfigRule -AccountId 123456789012 -AwsRegion eu-west-1 -ComplianceType COMPLIANT -ConfigRuleName desired-instance-type -ConfigurationAggregatorName raju | Select-Object -ExpandProperty EvaluationResultIdentifier | Select-Object -ExpandProperty EvaluationResultQualifier
```
**出力:**  

```
ConfigRuleName        ResourceId          ResourceType
--------------        ----------          ------------
desired-instance-type i-0f1bf2f34c5678d12 AWS::EC2::Instance
desired-instance-type i-0fd12dd3456789123 AWS::EC2::Instance
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetAggregateComplianceDetailsByConfigRule](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateConfigRuleComplianceSummary`
<a name="config-service_GetAggregateConfigRuleComplianceSummary_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定アグリゲータの非準拠ルールの数を返します。**  

```
(Get-CFGAggregateConfigRuleComplianceSummary -ConfigurationAggregatorName raju).AggregateComplianceCounts.ComplianceSummary.NonCompliantResourceCount
```
**出力:**  

```
CapExceeded CappedCount
----------- -----------
False       5
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetAggregateConfigRuleComplianceSummary](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateDiscoveredResourceCount`
<a name="config-service_GetAggregateDiscoveredResourceCounts_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、us-east-1 リージョンでフィルタリングされた指定アグリゲータのリソース数を返します。**  

```
Get-CFGAggregateDiscoveredResourceCount -ConfigurationAggregatorName Master -Filters_Region us-east-1
```
**出力:**  

```
GroupByKey GroupedResourceCounts NextToken TotalDiscoveredResources
---------- --------------------- --------- ------------------------
           {}                              455
```
**例 2: この例では、特定のアグリゲータのフィルタリングされたリージョンの RESOURCE\$1TYPE 別にグループ化されたリソース数を返します。**  

```
Get-CFGAggregateDiscoveredResourceCount -ConfigurationAggregatorName Master -Filters_Region us-east-1 -GroupByKey RESOURCE_TYPE | 
			Select-Object -ExpandProperty GroupedResourceCounts
```
**出力:**  

```
GroupName                          ResourceCount
---------                          -------------
AWS::CloudFormation::Stack         12
AWS::CloudFront::Distribution      1
AWS::CloudTrail::Trail             1
AWS::DynamoDB::Table               1
AWS::EC2::EIP                      2
AWS::EC2::FlowLog                  2
AWS::EC2::InternetGateway          4
AWS::EC2::NatGateway               2
AWS::EC2::NetworkAcl               4
AWS::EC2::NetworkInterface         12
AWS::EC2::RouteTable               13
AWS::EC2::SecurityGroup            18
AWS::EC2::Subnet                   16
AWS::EC2::VPC                      4
AWS::EC2::VPCEndpoint              2
AWS::EC2::VPCPeeringConnection     1
AWS::IAM::Group                    2
AWS::IAM::Policy                   51
AWS::IAM::Role                     78
AWS::IAM::User                     7
AWS::Lambda::Function              3
AWS::RDS::DBSecurityGroup          1
AWS::S3::Bucket                    3
AWS::SSM::AssociationCompliance    107
AWS::SSM::ManagedInstanceInventory 108
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetAggregateDiscoveredResourceCounts](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateDiscoveredResourceList`
<a name="config-service_ListAggregateDiscoveredResources_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、「アイルランド」アグリゲータで集約された指定リソースタイプのリソース ID を返します。リソースタイプのリストについては、https://docs.aws.amazon.com/sdkfornet/v4/apidocs/index.html?page=ConfigService/TConfigServiceResourceType.html&tocid=Amazon\$1ConfigService\$1ResourceType を確認してください。**  

```
Get-CFGAggregateDiscoveredResourceList -ConfigurationAggregatorName Ireland -ResourceType ([Amazon.ConfigService.ResourceType]::AWSAutoScalingAutoScalingGroup)
```
**出力:**  

```
ResourceId      : arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:12e3b4fc-1234-1234-a123-1d2ba3c45678:autoScalingGroupName/asg-1
ResourceName    : asg-1
ResourceType    : AWS::AutoScaling::AutoScalingGroup
SourceAccountId : 123456789012
SourceRegion    : eu-west-1
```
**例 2: この例では、us-east-1 リージョンでフィルタリングされた指定アグリゲータの「default」という名前のリソースタイプ `AwsEC2SecurityGroup` を返します。**  

```
Get-CFGAggregateDiscoveredResourceList -ConfigurationAggregatorName raju -ResourceType ([Amazon.ConfigService.ResourceType]::AWSEC2SecurityGroup) -Filters_Region us-east-1 -Filters_ResourceName default
```
**出力:**  

```
ResourceId      : sg-01234bd5dbfa67c89
ResourceName    : default
ResourceType    : AWS::EC2::SecurityGroup
SourceAccountId : 123456789102
SourceRegion    : us-east-1

ResourceId      : sg-0123a4ebbf56789be
ResourceName    : default
ResourceType    : AWS::EC2::SecurityGroup
SourceAccountId : 123456789102
SourceRegion    : us-east-1

ResourceId      : sg-4fc1d234
ResourceName    : default
ResourceType    : AWS::EC2::SecurityGroup
SourceAccountId : 123456789102
SourceRegion    : us-east-1
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ListAggregateDiscoveredResources](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateResourceConfig`
<a name="config-service_GetAggregateResourceconfig-service_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、集約された指定リソースの設定項目を返して、設定を展開します。**  

```
(Get-CFGAggregateResourceConfig -ResourceIdentifier_SourceRegion us-east-1 -ResourceIdentifier_SourceAccountId 123456789012 -ResourceIdentifier_ResourceId sg-4fc1d234 -ResourceIdentifier_ResourceType ([Amazon.ConfigService.ResourceType]::AWSEC2SecurityGroup) -ConfigurationAggregatorName raju).Configuration | ConvertFrom-Json
```
**出力:**  

```
{"description":"default VPC security group","groupName":"default","ipPermissions":[{"ipProtocol":"-1","ipv6Ranges":[],"prefixListIds":[],"userIdGroupPairs":[{"groupId":"sg-4fc1d234","userId":"123456789012"}],"ipv4Ranges":[],"ipRanges":[]},{"fromPort":3389,"ipProtocol":"tcp","ipv6Ranges":[],"prefixListIds":[],"toPort":3389,"userIdGroupPairs":[],"ipv4Ranges":[{"cidrIp":"54.240.197.224/29","description":"office subnet"},{"cidrIp":"72.21.198.65/32","description":"home pc"}],"ipRanges":["54.240.197.224/29","72.21.198.65/32"]}],"ownerId":"123456789012","groupId":"sg-4fc1d234","ipPermissionsEgress":[{"ipProtocol":"-1","ipv6Ranges":[],"prefixListIds":[],"userIdGroupPairs":[],"ipv4Ranges":[{"cidrIp":"0.0.0.0/0"}],"ipRanges":["0.0.0.0/0"]}],"tags":[],"vpcId":"vpc-2d1c2e34"}
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetAggregateResourceconfig-service](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregateResourceConfigBatch`
<a name="config-service_BatchGetAggregateResourceconfig-service_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定アグリゲータに存在するリソース (識別済み) の現在の設定項目を取得します。**  

```
$resIdentifier=[Amazon.ConfigService.Model.AggregateResourceIdentifier]@{
		ResourceId= "i-012e3cb4df567e8aa"
		ResourceName = "arn:aws:ec2:eu-west-1:123456789012:instance/i-012e3cb4df567e8aa"
		ResourceType = [Amazon.ConfigService.ResourceType]::AWSEC2Instance
		SourceAccountId = "123456789012"
		SourceRegion = "eu-west-1"
	}
		
	Get-CFGAggregateResourceConfigBatch -ResourceIdentifier $resIdentifier -ConfigurationAggregatorName raju
```
**出力:**  

```
BaseConfigurationItems UnprocessedResourceIdentifiers
---------------------- ------------------------------
{}                     {arn:aws:ec2:eu-west-1:123456789012:instance/i-012e3cb4df567e8aa}
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[BatchGetAggregateResourceconfig-service](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGAggregationAuthorizationList`
<a name="config-service_DescribeAggregationAuthorizations_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、アグリゲータに付与された認証を取得します。**  

```
Get-CFGAggregationAuthorizationList
```
**出力:**  

```
AggregationAuthorizationArn                                                            AuthorizedAccountId AuthorizedAwsRegion CreationTime
---------------------------                                                            ------------------- ------------------- ------------
arn:aws:config-service:eu-west-1:123456789012:aggregation-authorization/123456789012/eu-west-1 123456789012        eu-west-1           8/26/2019 12:55:27 AM
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeAggregationAuthorizations](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceByConfigRule`
<a name="config-service_DescribeComplianceByConfigRule_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、ルールの現在の評価結果がないため、INSUFFICIENT\$1DATA が返されるルール ebs-optimized-instance のコンプライアンスの詳細を取得します。**  

```
(Get-CFGComplianceByConfigRule -ConfigRuleName ebs-optimized-instance).Compliance
```
**出力:**  

```
ComplianceContributorCount ComplianceType
-------------------------- --------------
                           INSUFFICIENT_DATA
```
**例 2: この例では、ルール ALB\$1HTTP\$1TO\$1HTTPS\$1REDIRECTION\$1CHECK の非準拠リソースの数を返します。**  

```
(Get-CFGComplianceByConfigRule -ConfigRuleName ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK -ComplianceType NON_COMPLIANT).Compliance.ComplianceContributorCount
```
**出力:**  

```
CapExceeded CappedCount
----------- -----------
False       2
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeComplianceByConfigRule](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceByResource`
<a name="config-service_DescribeComplianceByResource_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、「COMPLIANT」コンプライアンスタイプの `AWS::SSM::ManagedInstanceInventory` リソースタイプを確認します。**  

```
Get-CFGComplianceByResource -ComplianceType COMPLIANT -ResourceType AWS::SSM::ManagedInstanceInventory
```
**出力:**  

```
Compliance                            ResourceId          ResourceType
----------                            ----------          ------------
Amazon.ConfigService.Model.Compliance i-0123bcf4b567890e3 AWS::SSM::ManagedInstanceInventory
Amazon.ConfigService.Model.Compliance i-0a1234f6f5d6b78f7 AWS::SSM::ManagedInstanceInventory
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeComplianceByResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceDetailsByConfigRule`
<a name="config-service_GetComplianceDetailsByConfigRule_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、ルール access-keys-rotated の評価結果を取得し、コンプライアンスタイプ別にグループ化された出力を返します。**  

```
Get-CFGComplianceDetailsByConfigRule -ConfigRuleName access-keys-rotated | Group-Object ComplianceType
```
**出力:**  

```
Count Name                      Group
----- ----                      -----
    2 COMPLIANT                 {Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationResult}
    5 NON_COMPLIANT             {Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationResult, Amazon.ConfigService.Model.EvaluationRes...
```
**例 2: この例では、COMPLIANT リソースの access-keys-rotated ルールのコンプライアンスの詳細をクエリします。**  

```
Get-CFGComplianceDetailsByConfigRule -ConfigRuleName access-keys-rotated -ComplianceType COMPLIANT | ForEach-Object {$_.EvaluationResultIdentifier.EvaluationResultQualifier}
```
**出力:**  

```
ConfigRuleName      ResourceId            ResourceType
--------------      ----------            ------------
access-keys-rotated BCAB1CDJ2LITAPVEW3JAH AWS::IAM::User
access-keys-rotated BCAB1CDJ2LITL3EHREM4Q AWS::IAM::User
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetComplianceDetailsByConfigRule](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceDetailsByResource`
<a name="config-service_GetComplianceDetailsByResource_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定されたリソースについて次のような結果が出ました。**  

```
Get-CFGComplianceDetailsByResource -ResourceId ABCD5STJ4EFGHIVEW6JAH -ResourceType 'AWS::IAM::User'
```
**出力:**  

```
Annotation                 :
ComplianceType             : COMPLIANT
ConfigRuleInvokedTime      : 8/25/2019 11:34:56 PM
EvaluationResultIdentifier : Amazon.ConfigService.Model.EvaluationResultIdentifier
ResultRecordedTime         : 8/25/2019 11:34:56 PM
ResultToken                :
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetComplianceDetailsByResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceSummaryByConfigRule`
<a name="config-service_GetComplianceSummaryByConfigRule_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: このサンプルは、非準拠の Config ルールの数を返します。**  

```
Get-CFGComplianceSummaryByConfigRule -Select ComplianceSummary.NonCompliantResourceCount
```
**出力:**  

```
CapExceeded CappedCount
----------- -----------
False       9
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetComplianceSummaryByConfigRule](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGComplianceSummaryByResourceType`
<a name="config-service_GetComplianceSummaryByResourceType_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: このサンプルは、準拠または非準拠のリソースの数を返し、出力を json に変換します。**  

```
Get-CFGComplianceSummaryByResourceType -Select ComplianceSummariesByResourceType.ComplianceSummary | ConvertTo-Json
{
  "ComplianceSummaryTimestamp": "2019-12-14T06:14:49.778Z",
  "CompliantResourceCount": {
    "CapExceeded": false,
    "CappedCount": 2
  },
  "NonCompliantResourceCount": {
    "CapExceeded": true,
    "CappedCount": 100
  }
}
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetComplianceSummaryByResourceType](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigRule`
<a name="config-service_DescribeConfigRules_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: このサンプルは、選択したプロパティを持つアカウントの設定ルールを一覧表示します。**  

```
Get-CFGConfigRule | Select-Object ConfigRuleName, ConfigRuleId, ConfigRuleArn, ConfigRuleState
```
**出力:**  

```
ConfigRuleName                                    ConfigRuleId       ConfigRuleArn                                                        ConfigRuleState
--------------                                    ------------       -------------                                                        ---------------
ALB_REDIRECTION_CHECK                             config-rule-12iyn3 arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-12iyn3 ACTIVE
access-keys-rotated                               config-rule-aospfr arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-aospfr ACTIVE
autoscaling-group-elb-healthcheck-required        config-rule-cn1f2x arn:aws:config-service:eu-west-1:123456789012:config-rule/config-rule-cn1f2x ACTIVE
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigRules](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigRuleEvaluationStatus`
<a name="config-service_DescribeConfigRuleEvaluationStatus_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: このサンプルは、指定された設定ルールのステータス情報を返します。**  

```
Get-CFGConfigRuleEvaluationStatus -ConfigRuleName root-account-mfa-enabled, vpc-flow-logs-enabled
```
**出力:**  

```
ConfigRuleArn                : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-kvq1wk
ConfigRuleId                 : config-rule-kvq1wk
ConfigRuleName               : root-account-mfa-enabled
FirstActivatedTime           : 8/27/2019 8:05:17 AM
FirstEvaluationStarted       : True
LastErrorCode                :
LastErrorMessage             :
LastFailedEvaluationTime     : 1/1/0001 12:00:00 AM
LastFailedInvocationTime     : 1/1/0001 12:00:00 AM
LastSuccessfulEvaluationTime : 12/13/2019 8:12:03 AM
LastSuccessfulInvocationTime : 12/13/2019 8:12:03 AM

ConfigRuleArn                : arn:aws:config:eu-west-1:123456789012:config-rule/config-rule-z1s23b
ConfigRuleId                 : config-rule-z1s23b
ConfigRuleName               : vpc-flow-logs-enabled
FirstActivatedTime           : 8/14/2019 6:23:44 AM
FirstEvaluationStarted       : True
LastErrorCode                :
LastErrorMessage             :
LastFailedEvaluationTime     : 1/1/0001 12:00:00 AM
LastFailedInvocationTime     : 1/1/0001 12:00:00 AM
LastSuccessfulEvaluationTime : 12/13/2019 7:12:01 AM
LastSuccessfulInvocationTime : 12/13/2019 7:12:01 AM
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigRuleEvaluationStatus](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigurationAggregatorList`
<a name="config-service_DescribeConfigurationAggregators_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、リージョン/アカウントのすべてのアグリゲータを返します。**  

```
Get-CFGConfigurationAggregatorList
```
**出力:**  

```
AccountAggregationSources     : {Amazon.ConfigService.Model.AccountAggregationSource}
ConfigurationAggregatorArn    : arn:aws:config-service:eu-west-1:123456789012:config-aggregator/config-aggregator-xabca1me
ConfigurationAggregatorName   : IrelandMaster
CreationTime                  : 8/25/2019 11:42:39 PM
LastUpdatedTime               : 8/25/2019 11:42:39 PM
OrganizationAggregationSource :

AccountAggregationSources     : {}
ConfigurationAggregatorArn    : arn:aws:config-service:eu-west-1:123456789012:config-aggregator/config-aggregator-qubqabcd
ConfigurationAggregatorName   : raju
CreationTime                  : 8/11/2019 8:39:25 AM
LastUpdatedTime               : 8/11/2019 8:39:25 AM
OrganizationAggregationSource : Amazon.ConfigService.Model.OrganizationAggregationSource
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigurationAggregators](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigurationAggregatorSourcesStatus`
<a name="config-service_DescribeConfigurationAggregatorSourcesStatus_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定アグリゲータ内のソースに対してリクエストされたフィールドを表示します。**  

```
Get-CFGConfigurationAggregatorSourcesStatus -ConfigurationAggregatorName raju | select SourceType, LastUpdateStatus, LastUpdateTime, SourceId
```
**出力:**  

```
SourceType   LastUpdateStatus LastUpdateTime        SourceId
----------   ---------------- --------------        --------
ORGANIZATION SUCCEEDED        12/31/2019 7:45:06 AM Organization
ACCOUNT      SUCCEEDED        12/31/2019 7:09:38 AM 612641234567
ACCOUNT      SUCCEEDED        12/31/2019 7:12:53 AM 933301234567
ACCOUNT      SUCCEEDED        12/31/2019 7:18:10 AM 933301234567
ACCOUNT      SUCCEEDED        12/31/2019 7:25:17 AM 933301234567
ACCOUNT      SUCCEEDED        12/31/2019 7:25:49 AM 612641234567
ACCOUNT      SUCCEEDED        12/31/2019 7:26:11 AM 612641234567
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigurationAggregatorSourcesStatus](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigurationRecorder`
<a name="config-service_DescribeConfigurationRecorders_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、設定レコーダーの詳細を返します。**  

```
Get-CFGConfigurationRecorder | Format-List
```
**出力:**  

```
Name           : default
RecordingGroup : Amazon.ConfigService.Model.RecordingGroup
RoleARN        : arn:aws:iam::123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigurationRecorders](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConfigurationRecorderStatus`
<a name="config-service_DescribeConfigurationRecorderStatus_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: このサンプルは、設定レコーダーのステータスを返します。**  

```
Get-CFGConfigurationRecorderStatus
```
**出力:**  

```
LastErrorCode        :
LastErrorMessage     :
LastStartTime        : 10/11/2019 10:13:51 AM
LastStatus           : Success
LastStatusChangeTime : 12/31/2019 6:14:12 AM
LastStopTime         : 10/11/2019 10:13:46 AM
Name                 : default
Recording            : True
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConfigurationRecorderStatus](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGConformancePack`
<a name="config-service_DescribeConformancePacks_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、すべての適合パックを一覧表示します。**  

```
Get-CFGConformancePack
```
**出力:**  

```
ConformancePackArn             : arn:aws:config:eu-west-1:123456789012:conformance-pack/dono/conformance-pack-p0acq8bpz
ConformancePackId              : conformance-pack-p0acabcde
ConformancePackInputParameters : {}
ConformancePackName            : dono
CreatedBy                      :
DeliveryS3Bucket               : kt-ps-examples
DeliveryS3KeyPrefix            :
LastUpdateRequestedTime        : 12/31/2019 8:45:31 AM
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConformancePacks](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGDeliveryChannel`
<a name="config-service_DescribeDeliveryChannels_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、リージョンの配信チャネルを取得し、詳細を表示します。**  

```
Get-CFGDeliveryChannel -Region eu-west-1 | Select-Object Name, S3BucketName, S3KeyPrefix, @{N="DeliveryFrequency";E={$_.ConfigSnapshotDeliveryProperties.DeliveryFrequency}}
```
**出力:**  

```
Name    S3BucketName               S3KeyPrefix DeliveryFrequency
----    ------------               ----------- -----------------
default config-bucket-NA my          TwentyFour_Hours
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeDeliveryChannels](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-CFGResourceTag`
<a name="config-service_ListTagsForResource_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定リソースに関連付けられたタグを一覧表示します。**  

```
Get-CFGResourceTag -ResourceArn $rules[0].ConfigRuleArn
```
**出力:**  

```
Key     Value
---     -----
Version 1.3
```
+  API の詳細については、AWS Tools for PowerShell コマンドレットリファレンス (V5) の「[ListTagsForResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。**

### `Remove-CFGConformancePack`
<a name="config-service_DeleteConformancePack_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、指定の適合パックと、パックのすべてのルール、修復アクション、評価結果を削除します。**  

```
Remove-CFGConformancePack -ConformancePackName dono
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-CFGConformancePack (DeleteConformancePack)" on target "dono".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteConformancePack](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Write-CFGConformancePack`
<a name="config-service_PutConformancePack_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、適合パックを作成し、指定の yaml ファイルからテンプレートを取得します。 **  

```
Write-CFGConformancePack -ConformancePackName dono -DeliveryS3Bucket amzn-s3-demo-bucket -TemplateBody (Get-Content C:\windows\temp\template.yaml -Raw)
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[PutConformancePack](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Write-CFGDeliveryChannel`
<a name="config-service_PutDeliveryChannel_powershell_topic"></a>

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

**Tools for PowerShell V5**  
**例 1: この例では、既存の配信チャネルの deliveryFrequency プロパティを変更します。**  

```
Write-CFGDeliveryChannel -ConfigSnapshotDeliveryProperties_DeliveryFrequency TwentyFour_Hours -DeliveryChannelName default -DeliveryChannel_S3BucketName amzn-s3-demo-bucket -DeliveryChannel_S3KeyPrefix my
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[PutDeliveryChannel](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。