Does anyone know how to get AWS account number using AWS Powershell? Doesn't look like there's an API available for that.
Not directly. However, your Account ID is a part of the Arn of resources that you create... and those that are automatically created for you. Some resources will also list you as an OwnerId.
The Default Security Group is automatically created for you in each region, and cannot be deleted. This makes it a reliable candidate for retrieving our account Id.
Example:
PS C:/> $accountId = @(get-ec2securitygroup -GroupNames "default")[0].OwnerId
PS C:/> $accountId
000011112222