[英]Cannot retrieve programmatically a certificate installed through mmc for a service account
[英]Is it possible to retrieve the the AWS Billing Account Id from an Account Id programmatically
我不確定這是否是正確的方法,但我能夠通過 AWS Organization SDK 實現我所需要的。
using var awsClient = new AmazonOrganizationsClient(assumeRoleAwsCredentials, RegionEndpoint.GetBySystemName(regionEndpointSystemName));
try
{
var response = await awsClient.DescribeOrganizationAsync(new DescribeOrganizationRequest());
return response.Organization.MasterAccountId;
}
catch (AWSOrganizationsNotInUseException)
{
return accountId;
}
因為不在組織中的賬戶會拋出AWSOrganizationsNotInUseException
所以賬單賬戶 ID 必須是它本身。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.