AWSSDK を使用してOrganizations アカウントを作成する - AWSSDK コードサンプル

AWSDocAWS SDKGitHub サンプルリポジトリには、さらに多くの SDK サンプルがあります

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

AWSSDK を使用してOrganizations アカウントを作成する

次のコード例は、Organizations アカウントを作成する方法を示しています。

.NET
AWS SDK for .NET
注記

他にもありますGitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Creates a new AWS Organizations account. The example was created /// using the AWS SDK for .NET version 3.7 and .NET Core 5.0. /// </summary> class CreateAccount { /// <summary> /// Initializes an Organizations client object and uses it to create /// the new account with the name specified in accountName. /// </summary> static async Task Main() { IAmazonOrganizations client = new AmazonOrganizationsClient(); var accountName = "ExampleAccount"; var email = "someone@example.com"; var request = new CreateAccountRequest { AccountName = accountName, Email = email, }; var response = await client.CreateAccountAsync(request); var status = response.CreateAccountStatus; Console.WriteLine($"The staus of {status.AccountName} is {status.State}."); } }
  • API の詳細については、AWS SDK for .NETAPI CreateAccountリファレンスのを参照してください