Skip to content

Commit 65b054f

Browse files
authored
feat: enhance m365 documentation (#9287)
1 parent 28d5b2b commit 65b054f

File tree

2 files changed

+143
-103
lines changed

2 files changed

+143
-103
lines changed

docs/user-guide/providers/microsoft365/authentication.mdx

Lines changed: 99 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,38 @@
22
title: "Microsoft 365 Authentication in Prowler"
33
---
44

5-
Prowler for Microsoft 365 supports multiple authentication types. Authentication methods vary between Prowler App and Prowler CLI:
5+
Prowler for Microsoft 365 supports multiple authentication types across Prowler Cloud and Prowler CLI.
66

7-
**Prowler App:**
7+
## Navigation
8+
- [Common Setup](#common-setup)
9+
- [Prowler Cloud Authentication](#prowler-cloud-authentication)
10+
- [Prowler CLI Authentication](#prowler-cli-authentication)
11+
- [Supported PowerShell Versions](#supported-powershell-versions)
12+
- [Required PowerShell Modules](#required-powershell-modules)
813

9-
- [**Application Certificate Authentication**](#certificate-based-authentication) (**Recommended**)
10-
- [**Application Client Secret Authentication**](#client-secret-authentication)
14+
## Common Setup
15+
16+
### Authentication Methods Overview
17+
18+
Prowler Cloud uses app-only authentication. Prowler CLI supports the same app-only options and two delegated flows.
19+
20+
**Prowler Cloud:**
21+
22+
- [**Application Certificate Authentication**](#application-certificate-authentication-recommended) (**Recommended**)
23+
- [**Application Client Secret Authentication**](#application-client-secret-authentication)
1124

1225
**Prowler CLI:**
1326

14-
- [**Application Certificate Authentication**](#certificate-based-authentication) (**Recommended**)
15-
- [**Application Client Secret Authentication**](#client-secret-authentication)
27+
- [**Application Certificate Authentication**](#application-certificate-authentication-recommended) (**Recommended**)
28+
- [**Application Client Secret Authentication**](#application-client-secret-authentication)
1629
- [**Azure CLI Authentication**](#azure-cli-authentication)
1730
- [**Interactive Browser Authentication**](#interactive-browser-authentication)
1831

19-
## Required Permissions
32+
### Required Permissions
2033

2134
To run the full Prowler provider, including PowerShell checks, two types of permission scopes must be set in **Microsoft Entra ID**.
2235

23-
### Application Permissions for App-Only Authentication
36+
#### Application Permissions for App-Only Authentication
2437

2538
When using service principal authentication, add these **Application Permissions**:
2639

@@ -44,6 +57,7 @@ When using service principal authentication, add these **Application Permissions
4457
These permissions enable application-based authentication methods (client secret and certificate). Using certificate-based authentication is the recommended way to run the full M365 provider, including PowerShell checks.
4558

4659
</Note>
60+
4761
### Browser Authentication Permissions
4862

4963
When using browser authentication, permissions are delegated to the user, so the user must have the appropriate permissions rather than the application.
@@ -52,37 +66,38 @@ When using browser authentication, permissions are delegated to the user, so the
5266
Browser and Azure CLI authentication methods limit scanning capabilities to checks that operate through Microsoft Graph API. Checks requiring PowerShell modules will not execute, as they need application-level permissions that cannot be delegated through browser authentication.
5367

5468
</Warning>
69+
5570
### Step-by-Step Permission Assignment
5671

5772
#### Create Application Registration
5873

59-
1. Access **Microsoft Entra ID**
74+
1. Access **Microsoft Entra ID**.
6075

6176
![Overview of Microsoft Entra ID](/images/providers/microsoft-entra-id.png)
6277

63-
2. Navigate to "Applications" > "App registrations"
78+
2. Navigate to "Applications" > "App registrations".
6479

6580
![App Registration nav](/images/providers/app-registration-menu.png)
6681

67-
3. Click "+ New registration", complete the form, and click "Register"
82+
3. Click "+ New registration", complete the form, and click "Register".
6883

6984
![New Registration](/images/providers/new-registration.png)
7085

71-
4. Go to "Certificates & secrets" > "Client secrets" > "+ New client secret"
86+
4. Go to "Certificates & secrets" > "Client secrets" > "+ New client secret".
7287

7388
![Certificate & Secrets nav](/images/providers/certificates-and-secrets.png)
7489

75-
5. Fill in the required fields and click "Add", then copy the generated value (this will be `AZURE_CLIENT_SECRET`)
90+
5. Fill in the required fields and click "Add", then copy the generated value (this will be `AZURE_CLIENT_SECRET`).
7691

7792
![New Client Secret](/images/providers/new-client-secret.png)
7893

7994
#### Grant Microsoft Graph API Permissions
8095

81-
1. Go to App Registration > Select your Prowler App > click on "API permissions"
96+
1. Open **API permissions** for the Prowler application registration.
8297

8398
![API Permission Page](/images/providers/api-permissions-page.png)
8499

85-
2. Click "+ Add a permission" > "Microsoft Graph" > "Application permissions"
100+
2. Click "+ Add a permission" > "Microsoft Graph" > "Application permissions".
86101

87102
![Add API Permission](/images/providers/add-app-api-permission.png)
88103

@@ -97,50 +112,53 @@ Browser and Azure CLI authentication methods limit scanning capabilities to chec
97112

98113
![Application Permissions](/images/providers/app-permissions.png)
99114

100-
4. Click "Add permissions", then click "Grant admin consent for `<your-tenant-name>`"
115+
4. Click "Add permissions", then click "Grant admin consent for `<your-tenant-name>`".
101116

117+
<a id="grant-powershell-module-permissions-for-app-only-authentication"></a>
102118
#### Grant PowerShell Module Permissions
103119
1. **Add Exchange API:**
104120

105-
- Search and select "Office 365 Exchange Online" API in **APIs my organization uses**
121+
- Search and select "Office 365 Exchange Online" API in **APIs my organization uses**.
106122

107123
![Office 365 Exchange Online API](/images/providers/search-exchange-api.png)
108124

109-
- Select "Exchange.ManageAsApp" permission and click "Add permissions"
125+
- Select "Exchange.ManageAsApp" permission and click "Add permissions".
110126

111127
![Exchange.ManageAsApp Permission](/images/providers/exchange-permission.png)
112128

113-
- Assign `Global Reader` role to the app: Go to `Roles and administrators` > click `here` for directory level assignment
129+
- Assign `Global Reader` role to the app: Go to `Roles and administrators` > click `here` for directory level assignment.
114130

115131
![Roles and administrators](/images/providers/here.png)
116132

117-
- Search for `Global Reader` and assign it to your application
133+
- Search for `Global Reader` and assign it to the application.
118134

119135
![Global Reader Role](/images/providers/global-reader-role.png)
120136

121137
2. **Add Teams API:**
122138

123-
- Search and select "Skype and Teams Tenant Admin API" in **APIs my organization uses**
139+
- Search and select "Skype and Teams Tenant Admin API" in **APIs my organization uses**.
124140

125141
![Skype and Teams Tenant Admin API](/images/providers/search-skype-teams-tenant-admin-api.png)
126142

127-
- Select "application_access" permission and click "Add permissions"
143+
- Select "application_access" permission and click "Add permissions".
128144

129145
![application_access Permission](/images/providers/teams-permission.png)
130146

131-
3. Click "Grant admin consent for `<your-tenant-name>`" to grant admin consent
147+
3. Click "Grant admin consent for `<your-tenant-name>`" to grant admin consent.
132148

133149
![Grant Admin Consent](/images/providers/grant-external-api-permissions.png)
134150

135151
Final permissions should look like this:
136152

137153
![Final Permissions](/images/providers/final-permissions.png)
138154

155+
Use the same application registration for both Prowler Cloud and Prowler CLI while switching authentication methods as needed.
156+
139157
<a id="client-secret-authentication"></a>
140158
<a id="certificate-based-authentication"></a>
141159
## Application Certificate Authentication (Recommended)
142160

143-
_Available for both Prowler App and Prowler CLI_
161+
_Available for both Prowler Cloud and Prowler CLI_
144162

145163
**Authentication flag for CLI:** `--certificate-auth`
146164

@@ -173,11 +191,11 @@ Guard `prowlerm365.key` and `prowlerm365.pfx`. Only upload the `.cer` file to th
173191

174192
</Warning>
175193

176-
If your organization uses a certificate authority, you can replace step 2 with a CSR workflow and import the signed certificate instead.
194+
If an internal certificate authority is preferred, replace step 2 with a CSR workflow and import the signed certificate instead.
177195

178196
### Upload the Certificate to Microsoft Entra ID
179197

180-
1. Open **Microsoft Entra ID** > **App registrations** > your application.
198+
1. Open **Microsoft Entra ID** > **App registrations** > the Prowler application.
181199
2. Go to **Certificates & secrets** > **Certificates**.
182200
3. Select **Upload certificate** and choose `prowlerm365.cer`.
183201
4. Confirm the certificate appears with the expected expiration date.
@@ -189,45 +207,37 @@ base64 -i prowlerm365.pfx -o prowlerm365.pfx.b64
189207
cat prowlerm365.pfx.b64 | tr -d '\n'
190208
```
191209

192-
Copy the resulting single-line Base64 string (or the contents of `prowlerm365.pfx.b64`)—you will use it in the next step.
210+
Copy the resulting single-line Base64 string (or the contents of `prowlerm365.pfx.b64`) for the next step.
193211

194212
### Provide the Certificate to Prowler
195213

196-
You can supply the private certificate to Prowler in two ways:
197-
198-
- **Environment variables (recommended for headless execution)**
199-
200-
```console
201-
export AZURE_CLIENT_ID="00000000-0000-0000-0000-000000000000"
202-
export AZURE_TENANT_ID="11111111-1111-1111-1111-111111111111"
203-
export M365_CERTIFICATE_CONTENT="$(base64 < prowlerm365.pfx | tr -d '\n')"
204-
```
205-
206-
The `M365_CERTIFICATE_CONTENT` variable must contain a single-line Base64 string. Remove any line breaks or spaces before exporting.
214+
- **Prowler Cloud:** Paste the Base64-encoded PFX in the `certificate_content` field when configuring the Microsoft 365 provider in Prowler Cloud.
215+
- **Prowler CLI:** Export credential variables or pass the local file path when running Prowler.
207216

208-
- **Local file path**
209-
210-
Store the PFX securely and reference it when you run the CLI:
217+
```console
218+
export AZURE_CLIENT_ID="00000000-0000-0000-0000-000000000000"
219+
export AZURE_TENANT_ID="11111111-1111-1111-1111-111111111111"
220+
export M365_CERTIFICATE_CONTENT="$(base64 < prowlerm365.pfx | tr -d '\n')"
221+
```
211222

212-
```console
213-
python3 prowler-cli.py m365 --certificate-auth --certificate-path /secure/path/prowlerm365.pfx
214-
```
223+
Store the PFX securely and reference it when running the CLI:
215224

216-
The CLI still needs `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` in the environment when you use `--certificate-path`.
225+
```console
226+
python3 prowler-cli.py m365 --certificate-auth --certificate-path /secure/path/prowlerm365.pfx
227+
```
217228

218-
For the **Prowler App**, paste the Base64-encoded PFX in the `certificate_content` field when you configure the provider secrets. The platform persists the encrypted certificate and supplies it during scans.
229+
The CLI still needs `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` in the environment when `--certificate-path` is used.
219230

220231
<Note>
221232
Do not mix certificate authentication with a client secret. Provide either a certificate **or** a secret to the application registration and Prowler configuration.
222233

223234
</Note>
224235

225-
<a id="client-secret-authentication"></a>
226236
<a id="service-principal-authentication"></a>
227237
<a id="service-principal-authentication-recommended"></a>
228238
## Application Client Secret Authentication
229239

230-
_Available for both Prowler App and Prowler CLI_
240+
_Available for both Prowler Cloud and Prowler CLI_
231241

232242
**Authentication flag for CLI:** `--sp-env-auth`
233243

@@ -239,35 +249,59 @@ export AZURE_CLIENT_SECRET="XXXXXXXXX"
239249
export AZURE_TENANT_ID="XXXXXXXXX"
240250
```
241251

242-
If these variables are not set or exported, execution using `--sp-env-auth` will fail.
243-
244-
Refer to the [Step-by-Step Permission Assignment](#step-by-step-permission-assignment) section below for setup instructions.
245-
246-
If the external API permissions described in the mentioned section above are not added only checks that work through MS Graph will be executed. This means that the full provider will not be executed.
247-
248-
This workflow is helpful for initial validation or temporary access. Plan to transition to certificate-based authentication to remove long-lived secrets and keep full provider coverage in unattended environments.
252+
If these variables are not set or exported, execution using `--sp-env-auth` will fail. This workflow is helpful for initial validation or temporary access. Plan to transition to certificate-based authentication to remove long-lived secrets and keep full provider coverage in unattended environments.
249253

250254
<Note>
251255
To scan every M365 check, ensure the required permissions are added to the application registration. Refer to the [PowerShell Module Permissions](#grant-powershell-module-permissions-for-app-only-authentication) section for more information.
252256

253257
</Note>
254258

255-
### Run Prowler with Certificate Authentication
259+
If the external API permissions described above are not added, only checks that work through Microsoft Graph will be executed. This means that the full provider will not be executed.
256260

257-
After the variables or path are in place, run the Microsoft 365 provider as usual:
261+
## Prowler Cloud Authentication
262+
263+
Use the shared permissions and credentials above, then complete the Microsoft 365 provider form in Prowler Cloud. The platform persists the encrypted credentials and supplies them during scans.
264+
265+
### Application Certificate Authentication (Recommended)
266+
267+
1. Select **Application Certificate Authentication**.
268+
2. Enter the **tenant ID** and **application (client) ID**.
269+
3. Paste the Base64-encoded certificate content.
270+
271+
This method keeps all Microsoft 365 checks available, including PowerShell-based checks.
272+
273+
### Application Client Secret Authentication
274+
275+
1. Select **Application Client Secret Authentication**.
276+
2. Enter the **tenant ID** and **application (client) ID**.
277+
3. Enter the **client secret**.
278+
279+
## Prowler CLI Authentication
280+
281+
### Certificate Authentication
282+
283+
**Authentication flag for CLI:** `--certificate-auth`
284+
285+
After credentials are exported, launch the Microsoft 365 provider with certificate authentication:
258286

259287
```console
260288
python3 prowler-cli.py m365 --certificate-auth --init-modules --log-level ERROR
261289
```
262290

263-
The command above initializes PowerShell modules if needed. You can combine other standard flags (for example, `--region M365USGovernment` or custom outputs) with `--certificate-auth`.
291+
Prowler prints the certificate thumbprint during execution so the correct credential can be verified.
264292

265-
Prowler prints the certificate thumbprint during execution so you can confirm the correct credential is in use.
293+
### Client Secret Authentication
266294

267-
<a id="azure-cli-authentication"></a>
268-
## Azure CLI Authentication
295+
**Authentication flag for CLI:** `--sp-env-auth`
269296

270-
_Available only for Prowler CLI_
297+
After exporting the secret-based variables, run:
298+
299+
```console
300+
python3 prowler-cli.py m365 --sp-env-auth --init-modules --log-level ERROR
301+
```
302+
303+
<a id="azure-cli-authentication"></a>
304+
### Azure CLI Authentication
271305

272306
**Authentication flag for CLI:** `--az-cli-auth`
273307

@@ -279,7 +313,7 @@ az login --tenant <TENANT_ID>
279313
az account set --tenant <TENANT_ID>
280314
```
281315

282-
If you prefer to reuse the same service principal that powers certificate-based authentication, authenticate it through Azure CLI instead of exporting environment variables. Azure CLI expects the certificate in PEM format; convert the PFX produced earlier and sign in:
316+
If reusing the same service principal that powers certificate-based authentication, authenticate it through Azure CLI instead of exporting environment variables. Azure CLI expects the certificate in PEM format; convert the PFX produced earlier and sign in:
283317

284318
```console
285319
openssl pkcs12 -in prowlerm365.pfx -out prowlerm365.pem -nodes
@@ -297,11 +331,9 @@ python3 prowler-cli.py m365 --az-cli-auth
297331

298332
The Azure CLI identity must hold the same Microsoft Graph and external API permissions required for the full provider. Signing in with a user account limits the scan to delegated Microsoft Graph endpoints and skips PowerShell-based checks. Use a service principal with the necessary application permissions to keep complete coverage.
299333

300-
## Interactive Browser Authentication
301-
302-
_Available only for Prowler CLI_
334+
### Interactive Browser Authentication
303335

304-
**Authentication flag:** `--browser-auth`
336+
**Authentication flag for CLI:** `--browser-auth`
305337

306338
Authenticate against Azure using the default browser to start the scan. The `--tenant-id` flag is also required.
307339

0 commit comments

Comments
 (0)