> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xsiam/cloud-security/cortex-cloud-saas-security/create-a-custom-rule.md).

# Create a Custom Rule

Learn more about SaaS Posture Custom Rules.

Custom Detection Rules help you create rules for specific scenarios to help you remediate SaaS application misconfigurations. Follow the steps below to Create, Update or Delete Custom Rules.

### Create a Custom Rule

1. Navigate to **Cloud Security > Rules and Policies**.
2. Click **Create Rule** and select the SaaS option.
3. Fill in the **Overview** details:
   1. Select the relevant instance/app (e.g., AHA Instance).
   2. Add labels (e.g., label one, label two).
   3. (Optional) Toggle to add remediation steps manually.
   4. (Optional) Attach custom compliance controls if available.
4. Define the Detection Rule: Under Simple Mode, select the Asset Category (e.g., Organization, Account). Build the JSON rule logic using the drop-down fields (e.g., set parameters like Number of admins does not equal 3).
5. Preview and Validate: Click Search to run a preview against existing onboarded assets to verify if the detection rule applies correctly. Step 6: Review the details on the read-only Review Screen and click Save.

***

### Manage Custom Rules

2. **Read / View a Custom Rule**:
   1. Navigate to the rules list under **Cloud Security > Rules and Policies**.
   2. Locate the created rule by searching for its name or filtering by asset type/provider.
   3. Click on the rule to open the side drawer/card to view its details, associated detection logic, and parameters.
3. **Update / Edit a Custom Rule:**
   1. Locate the custom rule in the rules table.
   2. Click the **Edit** (pencil) icon next to the section or rule you wish to modify.
   3. Update the necessary fields (such as description, labels, or rule criteria).
   4. Re-apply the search on the detection step if rule criteria were changed.
   5. Proceed through to the review screen and click **Save** to update the existing rule.
4. **Copy a Custom Rule**:
   1. Open the existing custom rule edit workflow, outlined above.
   2. Select the Save as **New** option.
   3. Modify the rule name (e.g., add \_copy) since two rules cannot share the exact same name.
   4. Adjust any required settings and click **Save** to generate a separate, new custom rule.
5. **Disable / Delete / Resolve a Rule**: Toggle the rule status to Disabled in the rules table.

{% hint style="info" %}
Disabling an active custom rule stops new issues from generating and automatically resolves existing open issues tied to that rule.
{% endhint %}

You can also use a Custom Rule to create a Custom Policy. Learn about creating [Custom Policies](https://cortex-docs.paloaltonetworks.com/cortex-xsiam/cloud-security/rules-and-policies/cloud-security-rules-and-policies/create-and-manage-cloud-security-policies/create-a-cloud-security-policy).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xsiam/cloud-security/cortex-cloud-saas-security/create-a-custom-rule.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
