How to create Prowler Service Principal Application¶
To allow Prowler assume an identity to start the scan with the required privileges is necesary to create a Service Principal. This Service Principal is going to be used to authenticate against Azure and retrieve the metadata needed to perform the checks.
To create a Service Principal Application you can use the Azure Portal or the Azure CLI.
From Azure Portal¶
- Access to Microsoft Entra ID
- In the left menu bar, go to "App registrations"
- Once there, in the menu bar click on "+ New registration" to register a new application
- Fill the "Name, select the "Supported account types" and click on "Register. You will be redirected to the applications page.
- Once in the application page, in the left menu bar, select "Certificates & secrets"
- In the "Certificates & secrets" view, click on "+ New client secret"
- Fill the "Description" and "Expires" fields and click on "Add"
- Copy the value of the secret, it is going to be used as
AZURE_CLIENT_SECRET
environment variable.
From Azure CLI¶
To create a Service Principal using the Azure CLI, follow the next steps:
- Open a terminal and execute the following command to create a new Service Principal application:
- The output of the command is going to be similar to the following:
- Save the values of
appId
,password
andtenant
to be used as credentials in Prowler.
Assigning the proper permissions¶
To allow Prowler to retrieve metadata from the identity assumed and run specific Entra checks, it is needed to assign the following permissions:
Directory.Read.All
Policy.Read.All
UserAuthenticationMethod.Read.All
(used only for the Entra checks related with multifactor authentication)
To assign the permissions you can make it from the Azure Portal or using the Azure CLI.
Note
Once you have created and assigned the proper Entra permissions to the application, you can go to this tutorial to add the subscription permissions to the application and start scanning your resources.
From Azure Portal¶
- Access to Microsoft Entra ID
- In the left menu bar, go to "App registrations"
- Once there, select the application that you have created
- In the left menu bar, select "API permissions"
- Then click on "+ Add a permission" and select "Microsoft Graph"
- Once in the "Microsoft Graph" view, select "Application permissions"
- Finally, search for "Directory", "Policy" and "UserAuthenticationMethod" select the following permissions:
Directory.Read.All
Policy.Read.All
UserAuthenticationMethod.Read.All
- Click on "Add permissions" to apply the new permissions.
- Finally, an admin should click on "Grant admin consent for [your tenant]" to apply the permissions.
From Azure CLI¶
- Open a terminal and execute the following command to assign the permissions to the Service Principal:
- The admin consent is needed to apply the permissions, an admin should execute the following command: