SSO Integrations: No module named social.backends.azuread

I was trying to setup: SSO with azure AD following opnedx docs. After setting up this config, LMS is crashing with below exception. what is easiest way to patch this issue with tutor without rebuilding,


“THIRD_PARTY_AUTH_BACKENDS”: [“social.backends.azuread.AzureADOAuth2”],

1 Like

Hi @venkat.330! I believe you forgot to post the exception you are facing.

I though that was the subject …

lms-worker_1        |   File "./", line 120, in <module>
lms-worker_1        |
lms-worker_1        |   File "/openedx/edx-platform/lms/", line 19, in run
lms-worker_1        |     django.setup()
lms-worker_1        |   File "/openedx/venv/local/lib/python2.7/site-packages/django/", line 27, in setup
lms-worker_1        |     apps.populate(settings.INSTALLED_APPS)
lms-worker_1        |   File "/openedx/venv/local/lib/python2.7/site-packages/django/apps/", line 108, in populate
lms-worker_1        |     app_config.import_models()
lms-worker_1        |   File "/openedx/venv/local/lib/python2.7/site-packages/django/apps/", line 202, in import_models
lms-worker_1        |     self.models_module = import_module(models_module_name)
lms-worker_1        |   File "/usr/lib/python2.7/importlib/", line 37, in import_module
lms-worker_1        |     __import__(name)
lms-worker_1        |   File "/openedx/edx-platform/common/djangoapps/third_party_auth/", line 51, in <module>
lms-worker_1        |     _PSA_BACKENDS = { backend_class for backend_class in _load_backend_classes()}
Stopping tutor_local_lms_1              ... done
lms-worker_1        |     _PSA_BACKENDS = { backend_class for backend_class in _load_backend_classes()}
lms-worker_1        |   File "/openedx/edx-platform/common/djangoapps/third_party_auth/", line 48, in _load_backend_classes
lms-worker_1        |     auth_class = module_member(class_path)
lms-worker_1        |   File "/openedx/venv/local/lib/python2.7/site-packages/social_core/", line 58, in module_member
lms-worker_1        |     module = import_module(mod)
lms-worker_1        |   File "/openedx/venv/local/lib/python2.7/site-packages/social_core/", line 52, in import_module
lms-worker_1        |     __import__(name)
lms-worker_1        | ImportError: No module named social.backends.azuread

I have never used the Azure identity provider, but I’m pretty sure there is a mistake in the official Open edX docs. Please try with “social_core” instead of “social”:

"THIRD_PARTY_AUTH_BACKENDS": ["social_core.backends.azuread.AzureADOAuth2"]

EDIT: I created a PR to fix the docs upstream


Thanks, it worked.:slight_smile:

How to configure the above Azure AD SSO in tutor?

Hi @regis, @venkat.330,

I am trying to configure azure ad sso as below by creating plugin.

name: SSO
version: 0.1.0
  openedx-common-settings: |
    THIRD_PARTY_AUTH_BACKENDS = ["social_core.backends.azuread.AzureADOAuth2"]

Upon running below command returns nil

grep -r SSO "$(tutor config printroot)/env/apps/openedx/settings/"

In super user login, I tried adding oauth provider, but oauth-backend doesn’t lists on the dropdown.

Any idea what could have gone wrong?

This will not return anything because your plugin patches do not contain the “SSO” string. Install your plugin, enable it, update the environment with tutor config save, then grep AzureADOAuth2.

Got the output for this. [I gave wrong command to grep earlier]

But I am unable to view the backend-name in Provider configuration of superadmin.
Screen shot attached

The plugin seems to have been installed fine.

Later we did tutor local quickstart, but the backend-name dropdown is empty.

The /lms/envs/ file has the below code, which would eventually result in population of the “Backend Name” property in the database.

Are we missing any step that is perhaps not firing the required DB migrations?

According to the edx-platform source code, if you decide to modify the common settings, then it is AUTHENTICATION_BACKENDS which you need to modify, and not THIRD_PARTY_AUTH_BACKENDS.

THIRD_PARTY_AUTH_BACKENDS is taken into account only if it is added to the lms/cms.env.json files. Thus, to define this, you need to implement the lms-env tutor patch.

1 Like

Thanks for checking this @regis.

So, the ‘Config’ plugins don’t overwite the lms.env.json files but the ‘patch’ plugins do. Is that the right understanding?

Yes. Adding stuff to config adds values to the $(tutor config printroot)/config.yml file, while patch statements add content to the tutor templates – including lms.env.json, the settings files, etc.


Thank you. We were able to get the required entries in the lms.env.json file.