# I have enabled anomaly detection but it doesn't work for my AD connection

**URL:** <https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924>\
**Category:** Get Help\
**Tags:** anomaly, anomaly-detection\
**Created:** [June 1, 2020, 7:52pm UTC](https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924 "2020-06-01T19:52:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saltuk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saltuk/32/14364_2.png) [@Saltuk](https://community.auth0.com/u/Saltuk)\
**Post date:** [June 1, 2020, 7:52pm UTC](https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924/1 "2020-06-01T19:52:42Z")

</div>

I have enabled brute force protection both for single user and for multi user but protection doesn’t work for some of my AD connections and regular Auth0 DB connections. On the Auth0 logs, I’m getting the following error message:

```auto
"type": "limit_wc",
"description": "User (redacted) attempted 10 consecutive logins unsuccessfully. Brute force protection is disabled for this connection, user is not locked",
...redacted

```

What might be the issue?

---

<div class="post-metadata">

**Author:** ![Saltuk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saltuk/32/14364_2.png) [@Saltuk](https://community.auth0.com/u/Saltuk)\
**Post date:** [June 1, 2020, 8:01pm UTC](https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924/2 "2020-06-01T20:01:03Z")

</div>

You will need to check if [**brute\_force\_protection**](https://auth0.com/docs/anomaly-detection/guides/enable-disable-brute-force-protection) option is set to **true** for those connections. If this attribute is missing or set to **false** it has to be set to **true**. Here are the instructions.

1- Get all the available connections for your tenant with [get all connections management API.](https://auth0.com/docs/api/management/v2#!/Connections/get_connections)

2- Find the connection id and the options object for a connection you need to add **brute\_force\_protection** attribute . Here is an example from my tenant:

Connection id : **con\_KCVvhZ4XyXDM4OPf**

```auto
  {
    "options": {
      "mfa": {
        "active": true,
        "return_enroll_settings": true
      },
      "import_mode": false,
      "configuration": {},
      "disable_signup": false,
      "passwordPolicy": null,
      "password_history": {
        "size": 5,
        "enable": false
      },
      "strategy_version": 2,
      "requires_username": false,
      "password_dictionary": {
        "enable": false,
        "dictionary": []
      },
      "password_no_personal_info": {
        "enable": false
      },
      "password_complexity_options": {
        "min_length": 1
      },
      "enabledDatabaseCustomization": false
    }
  }

```

3- Use the existing **options** object above and add **“brute\_force\_protection”: true** as an additional attribute. **Please note that you need to keep the existing fields in the options object otherwise they will be lost while patching the connection.**

4- Call the [update a connection management API](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) using the connection id and the modified options object.

Here is the sample for the connection in step-2 with brute\_force\_protection option added.

```auto
{
    "options": {
      "mfa": {
        "active": true,
        "return_enroll_settings": true
      },
      "import_mode": false,
      "configuration": {},
      "disable_signup": false,
      "passwordPolicy": null,
      "password_history": {
        "size": 5,
        "enable": false
      },
      "strategy_version": 2,
      "requires_username": false,
      "password_dictionary": {
        "enable": false,
        "dictionary": []
      },
      "password_no_personal_info": {
        "enable": false
      },
      "password_complexity_options": {
        "min_length": 1
      },
      "enabledDatabaseCustomization": false,
      "brute_force_protection": true
    }
  }

```

You will need to repeat these steps for all your connections listed below:

```auto
1- Auth0 DB
2- Auth0 DB with custom DB scripts
3- Active directory connections
4- Passwordless connections

```

For the connections which already have **brute\_force\_protection** set **true** , you may skip updating them obviously. For other connection types, like social and other enterprise connections you don’t need to make changes.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [June 2, 2020, 9:00am UTC](https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924/3 "2020-06-02T09:00:56Z")

</div>

Thanks for sharing that Saltuk!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [June 2, 2020, 9:00am UTC](https://community.auth0.com/t/i-have-enabled-anomaly-detection-but-it-doesnt-work-for-my-ad-connection/43924/4 "2020-06-02T09:00:59Z")

</div>


