简体   繁体   中英

How to connect to multiple azure active directory account to your application?

I need to login in a NodeJS application using multiple Azure AD and fetch user details. I am not sure how to achieve this?

Currently, our application is communicating with an App that is associated with the one Azure AD. Normal Users from the new Azure AD are unable to login into the our system using Office365 credentials because Office365 is not allowing our app to access the users' profile associated with new Azure AD. But the users of new Azure AD with the role of Global Admins can log in onto our app. When normal users try to login onto our application the following message is displayed

<Name of the App> needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it.

Is this possible to connect to multiple Azure AD using the same application? And how to achieve this? Please add links and screenshots.

People who might face a similar issue with Azure AD in the Future.

In the settings of the app that you create in the Azure AD, you can make it multi-tenant and you can also specify what type of resources/data your app needs to access. There are two types of resources/data/actions that you access for the one you require admin role and for the other you don't.

If you are trying to access data related

To make multi-tenant:

Azure AD > App Registeration > Your App > Settings > Properties 

To update the permissions:

Azure AD > App Registeration > Your App > Settings > Required Permissions (Update them here)

How are you doing this for one AD connection pool? Here's a pseudo-code for polling multiple AD's and running functions such as authenticate

var ActiveDirectory = require('activedirectory');

var config_domain_1 = { url: 'ldap://dc.domain.com',
               baseDN: 'dc=domain,dc=com',
               username: 'username@domain.com',
               password: 'password' }

var config_domain_2 = { url: 'ldap://dc.domain.com',
               baseDN: 'dc=domain,dc=com',
               username: 'username@domain.com',
               password: 'password' }

var config_domain_2 = { url: 'ldap://dc.domain.com',
               baseDN: 'dc=domain,dc=com',
               username: 'username@domain.com',
               password: 'password' }

var ad_domain_1 = new ActiveDirectory(config_domain_1);
var ad_domain_2 = new ActiveDirectory(config_domain_2);
var ad_domain_3 = new ActiveDirectory(config_domain_3);

ad_domain_1.authenticate(username, password, function(err, auth) {...}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM