Remediate Alerts for IAM Security
The IAM security module provides two options for remediating alerts so that you can enforce the principle of least privilege across your AWS, Azure, and GCP environments. You can manually remediate the alerts by copying the AWS, Azure, or GCP CLI commands and then run them in your cloud environment or you can configure a custom python script to automate the remediation steps.
IAM automatic remediation is different from Prisma Cloud automatic remediation. The IAM module does not support the option to enable automatic remediation. Instead, Create an Alert Rule for Run-Time Checks, follow the instructions for configuring a custom python script or configure and run Azure IAM remediation script to manage automatic remediation for IAM alert rules using the messaging queuing service on the respective CSP.
Manually Remediate IAM Security Alerts—Copy and paste the CLI commands for your AWS, Azure, or GCP environments and then execute them to manually remove excess permissions.
Custom python scripts—Copy, paste, and configure the custom python scripts so that you can automate the steps of executing the CLI commands to remediate excess permissions in your AWS, Azure, or GCP environments.
Set up Automatic Remediation for AWS IAM Alerts
Set up Automatic Remediation for Azure IAM Alerts
Set up Remediation for GCP IAM Alerts
Automatic remediation for GCP IAM alerts is not supported.
Manually Remediate IAM Security Alerts
Follow the steps below to manually remediate alerts in AWS. You can follow similar steps in Azure and GCP.
View the existing alerts.
To view all of the policies that triggered an alert select Alerts > Overview.
Click Add Filter and select Policy Type > IAM. Filter the alerts to show only Alert State-Open alerts that are Remediable-Yes.

Select the violating policy that you want to remediate.
Investigate the policy violations.
Select the alert and click Investigate from the Actions menu. Here you can take a closer look at the asset that trigerred the policy violation.
Manually remediate the alert.
After you select the alert and click Remediate the CLI commands appears in a popup window.
Run the CLI commands on your AWS account. For GCP accounts, before you run the CLI command, set up remediation for GCP IAM alerts.
Once you execute the CLI commands the remediation process is complete. The SQS queue will now show 0 messages.
Set up Automatic Remediation for AWS IAM Alerts
Automate the remediation steps for your AWS IAM alerts with the help of a custom python script which receives an alert via the AWS SQS queue, extracts the alert ID and uses it to call the IAM remediation API, and runs the commands which are provided by the API response. Complete the following prerequisites to successfully run the python script. This includes the Prisma Cloud integrations, APIs, and python libraries.
Integrate Prisma Cloud with Amazon SQS—This is an AWS service that allows you to send, store, and receive messages between AWS and Prisma Cloud.
Create alert rules and set up alert notifications to Amazon SQS. All alerts triggered for the IAM policy you selected will be sent to the SQS queue.
Configure and Run AWS IAM Remediation Script
Install third party libraries to create HTTP requests to your API endpoints, and edit the custom python script to include the values for the environment variables so that you can automatically remediate alerts.
Copy/paste the script into a text editor or integrated development environment (IDE).
Install the third party libraries.
This script uses a total of five python libraries. Three of the libraries:
subprocess,logging, andjsonare part of the python core which allows you to import them into your programs after you install python. The other two libraries arerequestsandazure.servicebuswhich are third party libraries—or—libraries that you have to install before running the script. Python has a default package downloader calledpip, which can install third party libraries and frameworks through the command line.Install requests.
From the command line (Windows) or terminal (Linux/MacOS) type the following command:
pip install requestsRequests is a third party library for making simple HTTP requests
Install azure.servicebus.
From the command line (Windows) or terminal (Linux/MacOS) type the following command:
pip install azure.servicebusazure.servicebusis a client library for python to communicate between applications and services and implement asynchronous messaging patterns.
Edit the environment variables.
You will need to specify these variables in the python script to customize settings and run the commands provided by the API response. Review the environment variables and their values below:
SQS_QUEUE_NAME - A string that represents the name of the SQS queue that you created in step 1. For example,
Queue2_Policy_UUID.API_ENDPOINT - Your Prisma Cloud API subdomain. For example, if your tenant is
https://api.prismacloud.io, then theAPI_ENDPOINTwill beapi.DEBUG\- Displays the debug logs for your script which is enabled by default.YOUR_ACCOUNT_NUMBER - The 12-digit number, such as
123456789012, that uniquely identifies an AWS account. A user could have multiple account numbers.AUTH_KEY - Your JWT authentication token string (x-redlock-auth). See the API reference for more details.
These are mandatory variables to specify in the python script to run the commands provided by the API response and to customize the settings.
tt:[Optional (mac/linux only)]—Use the export command to set your environment variables.
If you’re not familiar with python and don’t want to edit the script then you can use the
exportcommand to set the environment variables. Here’s the syntax for doing so:% export API_ENDPOINT=api_tenant
% export YOUR_ACCOUNT_NUMBER=123456789
% export SQS_QUEUE_NAME=your_sqs_queue_name
% export YOUR_ACCOUNT_NUMBER=123456789
% export AUTH_KEY=your_jwt_token
% python script.py
The following instructions can be executed on any operating system that has python installed. For example, Windows, macOS, and Linux.
[DEBUG\].DEBUGis enabled or set toTrueby default. To disable logs, update the code snippet as follow:Edit YOUR_ACCOUNT_NUMBER.
Replace
YOUR_ACCOUNT_NUMBERwith the 12-digit account ID. The portion of the script to modify is:An example of valid values:
Edit API_ENDPOINT.
Replace
API_ENDPOINTwith the Prisma Cloud tenant sub domain that you’re using. The portion of the script to modify is:For example, replace
API_ENDPOINTwithapp,app2,app3, orapp.gov.Edit the
SQS_QUEUE_NAME.This stores the value of your queue name. The portion of the script to modify is:
Replace
SQS_QUEUE_NAMEwith the name of your actual queue—for example, ifQueue2_Policy_UUIDis the name of your queue, then the code snippet will be updated as follow:Edit the AUTH_KEY.
Generate a JWT token and replace the value in
AUTH_KEYof the python script. The portion of the script to modify is as follows:Replace
AUTH_KEYwith the JWT token that you generated.
View the remediation results.
After you configured the python script with your environment variables, run the script to view the remediation results.
Run the script.
Open up command prompt (Windows) or terminal (Linux/MacOS) and type in the following command:
python script.py
Replace script.py with the name of your actual script.
View the results.
After executing the python script, details related to the remediation will display in the output.
The output shows that we’re processing an alert for a resource named varname:[test-resource] which should now be gone when we view Alerts. The CLI commands for executing the remediation steps are shown in the output; these commands are automatically executed on your behalf by the python script. A new policy will be created in AWS that removes the excess permissions of the user.
Set up Automatic Remediation for Azure IAM Alerts
Automate the remediation steps for your IAM Azure alerts with the help of a custom python script—the script reads in the Azure Bus queue, collects alerts, and then goes into Azure and executes the CLI remediation steps. Complete the following prerequisites to successfully run the python script. This includes the Prisma Cloud integrations, APIs, and python libraries.
Integrate Prisma Cloud with Azure Serve Bus—This is an Azure service that allows you to send, store, and receive messages between Azure and Prisma Cloud. Follow the steps to Integrate Prisma Cloud with Azure Service Bus.
Create alert rules and set up alert notifications to Azure Service Bus. All alerts triggered for the IAM policy you selected will be sent to the SQS queue.
Configure and Run Azure IAM Remediation Script
Complete the following prerequisites so that you can set up everything you need to successfully run the python script. This includes the Prisma Cloud integrations, APIs, and python libraries.
Copy/paste the script into a text editor or integrated development environment (IDE).
Install the third party libraries.
This script uses a total of five python libraries. Three of the libraries:
subprocess,logging, andjsonare part of the python core which allows you to import them into your programs after you install python. The other two libraries arerequestsandazure.servicebuswhich are third party libraries—or—libraries that you have to install before running the script. Python has a default package downloader calledpip, which can install third party libraries and frameworks through the command line.Install requests.
From the command line (Windows) or terminal (Linux/MacOS) type the following command:
pip install requestsRequests is a third party library for making simple HTTP requests
Install azure.servicebus.
From the command line (Windows) or terminal (Linux/MacOS) type the following command:
pip install azure.servicebusazure.servicebusis a client library for python to communicate between applications and services and implement asynchronous messaging patterns.
Edit the environment variables.
You will need to specify these variables in the python script to customize settings and run the commands provided by the API response. Review the environment variables and their values below:
SQS_QUEUE_NAME - A string that represents the name of the SQS queue that you created in step 1. For example,
Queue2_Policy_UUID.API_ENDPOINT - Your Prisma Cloud API subdomain. For example, if your tenant is
https://api.prismacloud.io, then the API_ENDPOINT will beapi.DEBUG\ - Displays the debug logs for your script which is enabled by default.
YOUR_ACCOUNT_NUMBER - The 12-digit number, such as
123456789012, that uniquely identifies an AWS account. A user could have multiple account numbers.AUTH_KEY - Your JWT authentication token string (x-redlock-auth). See the API reference for more details.
These are mandatory variables to specify in the python script to run the commands provided by the API response and to customize the settings.
tt:[Optional (mac/linux only)]—Use the export command to set your environment variables.
If you’re not familiar with python and don’t want to edit the script then you can use the varname:[export] command to set the environment variables. Here’s the syntax for doing so:
% export SB_QUEUE_KEY=your_sb_queue_key
% export SB_QUEUE_KEY_NAME=your_sb_queue_key_name
% export SB_QUEUE_NAME_SPACE=your_sb_queue_name_space
% export API_ENDPOINT=api_tenant
% export AUTH_KEY=your_jwt_token
The following instructions can be executed on any operating system that has python installed. For example, Windows, macOS, and Linux.
View the remediation results.
After you configured the python script with your environment variables, run the script to view the remediation results.
Run the script.
Open up command prompt (Windows) or terminal (Linux/MacOS) and type in the following command:
python script.py
Replace script.py with the name of your actual script.
View the results.
After executing the python script, details related to the remediation will display in output.
Set up Remediation for GCP IAM Alerts
Prisma Cloud leverages the Deny Policies feature on GCP to remediate risky permissions to ensure a safe rollout in case you decide to revert the remediated risky permissions. Make sure you have done all the necessary configurations in your GCP environment to use Deny Policies.
GCP Deny Policies feature does not yet support all permissions due to which some of the alerts can be partially remediable or not remediable. The list of permissions in Prisma Cloud IAM security will be updated as per their availability in GCP.
Deny Policies is a public Beta release on GCP, so remediation will also be a Beta release on Prisma Cloud.
Add Filter and select Policy Type > IAM and Cloud Type > GCP.
Select the violating policy that you want to remediate.
Investigate the policy violations.
Get the remediation steps.
Under the OPTIONS column, click Remediate.
Copy the CLI commands.
After you click Remediate the CLI commands appears in a popup window.

Run the CLI commands on your GCP account. Before you run the CLI command, see Deny Policies.
After you execute the CLI commands, the remediation process is complete and the excess privileges will be revoked.
Last updated
Was this helpful?

