How can I get user's AAD group when I login? #3508
Replies: 3 comments 2 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
I'd suggest re-evaluating your code compared to the example. You made some changes that are affecting your login. The biggest issue that I see is that you have the |
Beta Was this translation helpful? Give feedback.
-
@alicechiou If it created the Admin group then it's because you had an old version of the script installed and it used that. It uses the name of the groups that are passed when creating them and appends them to the group_ids list that is then set on the user. I can assure you that the example script works as I've used it with many clients. You should simply need to update the STAFF and SUPERUSER_GROUPS lists to have the names of the Groups from AzureAD that you wish to correspond to those roles. The example uses Admin and will put the user in that group If you're wanting to see the group memberships for the user, they're printed in debug output in the example with the group_memberships list. |
Beta Was this translation helpful? Give feedback.
-
Hi sirs,
I successfully logged into Nautobot using SSO with AAD, but how can I retrieve the user's group from AAD? I have reviewed the documentation, but our user does not have any roles assigned in Azure. I only need to retrieve the user's group. How can I set this up?
document: https://docs.nautobot.com/projects/core/en/stable/configuration/authentication/sso/
I also checked the code: https://github.com/nautobot/nautobot/blob/main/examples/azure_ad/group_sync.py
But I don't have any ideas what need to set in here:
SOCIAL_AUTH_AZUREAD_OAUTH2_RESOURCE = ""
and in the code:
ROLES_GROUP_NAME = "roles"
SUPERUSER_GROUPS = ["Admin"]
STAFF_GROUPS = ["Admin"]
if user and response and response.get(ROLES_GROUP_NAME, False):
if my user not be assigned any roles in AAD, I just want retrieve the user's group, May I update ROLES_GROUP_NAME to "groups"
and set the group name to SUPERUSER_GROUPS and STAFF_GROUPS??
Thanks
Beta Was this translation helpful? Give feedback.
All reactions