# Having issues authenticating to Active Directory

**URL:** <https://forum.ansible.com/t/having-issues-authenticating-to-active-directory/31352>\
**Category:** AWX Project\
**Tags:** fedora, awx\
**Created:** [September 24, 2019, 3:28pm UTC](https://forum.ansible.com/t/having-issues-authenticating-to-active-directory/31352 "2019-09-24T15:28:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Meyer1](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Andrew\_Meyer1](https://forum.ansible.com/u/Andrew_Meyer1)\
**Post date:** [September 24, 2019, 3:28pm UTC](https://forum.ansible.com/t/having-issues-authenticating-to-active-directory/31352/1 "2019-09-24T15:28:57Z")

</div>

I am trying to setup AWX to connect to my AD environment and I continue to run into issues. I have gotten the user lookup to work. But it won’t log me in. Keeps complaining about a mapping. I don’t understand what I have wrong.

Here is my config:

`

{  
“AUTH\_LDAP\_SERVER\_URI”: “ldap://10.150.10.150:389”,  
“AUTH\_LDAP\_BIND\_DN”: “CN=ansible,OU=MY\_ORG,DC=ad,dc=example,DC=local”,  
“AUTH\_LDAP\_BIND\_PASSWORD”: “$encrypted$”,  
“AUTH\_LDAP\_START\_TLS”: false,  
“AUTH\_LDAP\_CONNECTION\_OPTIONS”: {  
“OPT\_REFERRALS”: 0,  
“OPT\_NETWORK\_TIMEOUT”: 300  
},  
“AUTH\_LDAP\_USER\_SEARCH”: [  
“OU=MY\_ORG,DC=ad,DC=example,DC=local”,  
“SCOPE\_SUBTREE”,  
“(&(objectClass=person)(sAMAccountName=%(user)s))”  
],  
“AUTH\_LDAP\_USER\_DN\_TEMPLATE”: null,  
“AUTH\_LDAP\_USER\_ATTR\_MAP”: {  
“email”: “mail”,  
“first\_name”: “givenName”,  
“last\_name”: “sn”  
},  
“AUTH\_LDAP\_GROUP\_SEARCH”: [  
“CN=ansible-tower-users,OU=MY\_ORG,DC=ad,DC=example,DC=local”,  
“SCOPE\_SUBTREE”,  
“(&(member=CN=%(user)s),OU=MY\_ORG,DC=ad,DC=example,DC=local)(objectClass=group))”  
],  
“AUTH\_LDAP\_GROUP\_TYPE”: “ActiveDirectoryGroupType”,  
“AUTH\_LDAP\_GROUP\_TYPE\_PARAMS”: {  
“name\_attr”: “cn”  
},  
“AUTH\_LDAP\_REQUIRE\_GROUP”: null,  
“AUTH\_LDAP\_DENY\_GROUP”: null,  
“AUTH\_LDAP\_USER\_FLAGS\_BY\_GROUP”: {  
“is\_superuser”: [  
“cn=ansible-tower-admins,OU=MY\_ORG,DC=ad,DC=example,DC=local”  
]  
},  
“AUTH\_LDAP\_ORGANIZATION\_MAP”: {  
“MY\_ORG”: {  
“users”: [  
“CN=ansible-tower-users,OU=MY\_ORG,DC=ad,DC=example,DC=local”  
],  
“remove\_admins”: false,  
“admins”: [  
“CN=ansible-tower-admins,OU=MY\_ORG,DC=ad,DC=example,DC=local”  
],  
“remove\_users”: false  
}  
},

`

This is from the docker container logs:

`

2019-09-24 15:27:54,879 DEBUG django\_auth\_ldap search\_s(‘OU=MY\_ORG,DC=ad,DC=example,DC=local’, 2, ‘(&(objectClass=person)(sAMAccountName=%(user)s))’) returned 1 objects: cn=ellen ripley,ou=MY\_ORG,dc=ad,dc=example,dc=local  
2019-09-24 15:27:54,887 DEBUG django\_auth\_ldap Creating Django user ellen.ripley  
2019-09-24 15:27:54,888 DEBUG django\_auth\_ldap Populating Django user ellen.ripley  
2019-09-24 15:27:54,907 DEBUG django\_auth\_ldap cn=ellen ripley,ou=MY\_ORG,dc=ad,dc=example,dc=local is a member of cn=ansible-tower-admins,ou=MY\_ORG,dc=ad,dc=example,dc=local  
2019-09-24 15:27:54,907 WARNING django\_auth\_ldap format requires a mapping while authenticating ellen.ripley  
2019-09-24 15:27:54,907 ERROR awx.sso.backends Encountered an error authenticating to LDAP  
Traceback (most recent call last):  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/sso/backends.py”, line 128, in authenticate  
return super(LDAPBackend, self).authenticate(request, username, password)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 150, in authenticate  
user = self.authenticate\_ldap\_user(ldap\_user, password)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 210, in authenticate\_ldap\_user  
return ldap\_user.authenticate(password)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 350, in authenticate  
self.\_get\_or\_create\_user()  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 609, in \_get\_or\_create\_user  
populate\_user.send(self.backend. **class** , user=self.\_user, ldap\_user=self)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/dispatch/dispatcher.py”, line 175, in send  
for receiver in self.\_live\_receivers(sender)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/dispatch/dispatcher.py”, line 175, in   
for receiver in self.\_live\_receivers(sender)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/sso/backends.py”, line 351, in on\_populate\_user  
ldap\_user.\_get\_groups().get\_group\_dns()  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 909, in get\_group\_dns  
group\_infos = self.\_get\_group\_infos()  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/backend.py”, line 921, in \_get\_group\_infos  
self.\_group\_search)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/config.py”, line 469, in user\_groups  
groups = search.execute(ldap\_user.connection)  
File “/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django\_auth\_ldap/config.py”, line 148, in execute  
filterstr = self.filterstr % filterargs  
TypeError: format requires a mapping  
2019-09-24 15:27:55,150 WARNING awx.api.generics Login failed for user ellen.ripley from 10.150.1.155  
2019-09-24 15:27:55,171 WARNING django.request Unauthorized: /api/login/  
2019-09-24 15:27:55,171 WARNING django.request Unauthorized: /api/login/  
[pid: 156|app: 0|req: 128/212] 10.150.1.155 () {52 vars in 1051 bytes} [Tue Sep 24 15:27:54 2019] POST /api/login/ =\> generated 5951 bytes in 553 msecs (HTTP/1.1 401) 8 headers in 392 bytes (1 switches on core 0)  
10.150.1.155 - - [24/Sep/2019:15:27:55 +0000] “POST /api/login/ HTTP/1.1” 401 5951 “[http://automation01.asm.example.local/](http://automation01.asm.example.local/)” “Mozilla/5.0 (X11; Fedora; Linux x86\_64; rv:69.0) Gecko/20100101 Firefox/69.0” “-”

`
