From 3aba71ad2f613cf2e6bef2d88c12175ebb3a09fb Mon Sep 17 00:00:00 2001 From: Pepe Fagoaga Date: Thu, 10 Aug 2023 12:40:17 +0200 Subject: [PATCH] docs(aws-orgs): Update syntax (#2703) --- docs/tutorials/aws/organizations.md | 35 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/docs/tutorials/aws/organizations.md b/docs/tutorials/aws/organizations.md index 63494976..820749c2 100644 --- a/docs/tutorials/aws/organizations.md +++ b/docs/tutorials/aws/organizations.md @@ -5,14 +5,15 @@ Prowler allows you to get additional information of the scanned account in CSV a If you have AWS Organizations Prowler can get your account details like Account Name, Email, ARN, Organization ID and Tags and you will have them next to every finding in the CSV and JSON outputs. -- In order to do that you can use the option `-O`/`--organizations-role `. See the following sample command: +In order to do that you can use the option `-O`/`--organizations-role `. See the following sample command: -``` -prowler aws -O arn:aws:iam:::role/ +```shell +prowler aws \ + -O arn:aws:iam:::role/ ``` > Make sure the role in your AWS Organizations management account has the permissions `organizations:ListAccounts*` and `organizations:ListTagsForResource`. -- In that command Prowler will scan the account and getting the account details from the AWS Organizations management account assuming a role and creating two reports with those details in JSON and CSV. +In that command Prowler will scan the account and getting the account details from the AWS Organizations management account assuming a role and creating two reports with those details in JSON and CSV. In the JSON output below (redacted) you can see tags coded in base64 to prevent breaking CSV or JSON due to its format: @@ -34,16 +35,24 @@ ACCOUNT_DETAILS_EMAIL,ACCOUNT_DETAILS_NAME,ACCOUNT_DETAILS_ARN,ACCOUNT_DETAILS_O If you want to run Prowler across all accounts of AWS Organizations you can do this: -- First get a list of accounts that are not suspended: +1. First get a list of accounts that are not suspended: -``` -ACCOUNTS_IN_ORGS=$(aws organizations list-accounts --query Accounts[?Status==`ACTIVE`].Id --output text) -``` + ```shell + ACCOUNTS_IN_ORGS=$(aws organizations list-accounts \ + --query "Accounts[?Status=='ACTIVE'].Id" \ + --output text \ + ) + ``` -- Then run Prowler to assume a role (same in all members) per each account, in this example it is just running one particular check: +2. Then run Prowler to assume a role (same in all members) per each account: -``` -for accountId in $ACCOUNTS_IN_ORGS; do prowler aws -O arn:aws:iam:::role/ -R arn:aws:iam::$accountId:role/; done -``` + ```shell + for accountId in $ACCOUNTS_IN_ORGS; + do + prowler aws \ + -O arn:aws:iam:::role/ \ + -R arn:aws:iam::"${accountId}":role/; + done + ``` -- Using the same for loop it can be scanned a list of accounts with a variable like `ACCOUNTS_LIST='11111111111 2222222222 333333333'` +> Using the same for loop it can be scanned a list of accounts with a variable like `ACCOUNTS_LIST='11111111111 2222222222 333333333'`