|
| 1 | +--- |
| 2 | +pcx_content_type: reference |
| 3 | +title: Rules |
| 4 | +sidebar: |
| 5 | + order: 4 |
| 6 | +--- |
| 7 | + |
| 8 | +DEX rules allow you to create and manage testing policies for targeted user groups within your [fleet](/cloudflare-one/insights/dex/tests/). When you create a rule, you define the scope of a test to specific selectors such as departments (like finance or sales), devices, and/or users. You can apply and reuse rules on your desired [tests](/cloudflare-one/insights/dex/tests/). |
| 9 | + |
| 10 | +DEX rules are ideal for admin who want to define the scope of a test to a specific group within their fleet to allow for efficient problem detection and resolution. |
| 11 | + |
| 12 | +## Create a rule |
| 13 | + |
| 14 | +To create a rule: |
| 15 | + |
| 16 | +1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **DEX** > **Rules**. |
| 17 | +2. Select **Add a rule**. |
| 18 | +3. Give your rule a name and build your desired expressions. |
| 19 | +4. Select **Create rule** to finalize your rule. |
| 20 | + |
| 21 | +### Selectors |
| 22 | + |
| 23 | +Selectors are required categories in a DEX rule expression that define a group within a fleet. The selector(s) you have defined in a rule will determine which group a test will impact. |
| 24 | + |
| 25 | +Review the available selectors and their scope in the following list. |
| 26 | + |
| 27 | +| Selector | Description | |
| 28 | +| ---------------------------- | ------------------------------------------------------------------------------------------------------------------ | |
| 29 | +| **User email** | For specifying user emails. | |
| 30 | +| **User group emails** | | |
| 31 | +| **User group IDs** | | |
| 32 | +| **User group names** | | |
| 33 | +| **Operating systems** | For specifying operating systems. | |
| 34 | +| **Operating system version** | For specifying an operating system version (use Operator `in`) or versions (use Operator `is`). | |
| 35 | +| **Managed network** | For specifying users accessing the network from the office (managed network) compared to those accessing remotely. | |
| 36 | +| **SAML attributes** | For advanced customization by leveraging SAML attributes. | |
| 37 | +| **Colos** | For specifying a specific Cloudflare data center location. | |
| 38 | + |
| 39 | +## Add a rule to a test |
| 40 | + |
| 41 | +After you have created a rule, you can add it to a test. If you do not add a rule to a test, the test will run on your entire device fleet. |
| 42 | + |
| 43 | +To add a rule to a test: |
| 44 | + |
| 45 | +1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **DEX** > **Tests**. |
| 46 | +2. Choose an existing test and select **Edit**, or select **Add a test** to make a new test. |
| 47 | +3. Under **Select DEX rules**, select the rule you would like to apply. |
| 48 | +4. Select **Save test** for an existing rule or **Add rule** for the new test. |
| 49 | + |
| 50 | +:::note |
| 51 | +Existing tests may take 24 hours to apply or remove a new rule. |
| 52 | +::: |
| 53 | + |
| 54 | +To view which tests a rule is being applied to: |
| 55 | + |
| 56 | +1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **DEX** > **Rules**. |
| 57 | +2. Select a rule > **Edit**. |
| 58 | +3. Select the **DEX tests** tab and review the list of tests that include your selected rule. |
| 59 | + |
| 60 | +## Create a test using a rule |
| 61 | + |
| 62 | +You can create a new test from the [DEX test dashboard as described above](/cloudflare-one/insights/dex/rules/#add-a-rule-to-a-test) or directly from the DEX rules dashboard. |
| 63 | + |
| 64 | +To create a new test using a rule from DEX rules: |
| 65 | + |
| 66 | +1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **DEX** > **Rules**. |
| 67 | +2. Select a rule > **Edit**. |
| 68 | +3. Select the **DEX tests** tab. |
| 69 | +4. You will be able to review all the tests that currently include this rule. To create a new rule, select **Create a test using this rule**. |
| 70 | +5. Enter all required information, making sure that the box next to your rule name is checked. |
| 71 | +6. Select **Add test**. |
| 72 | + |
| 73 | +## Related resources |
| 74 | + |
| 75 | +- [DEX HTTP test](/cloudflare-one/insights/dex/tests/http/) - Assess the accessibility of a web application. |
| 76 | +- [DEX Traceroute test](/cloudflare-one/insights/dex/tests/traceroute/) - Measure the network path of an IP packet from an end-user device to a server. |
0 commit comments