Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tenant selection to Azure AD extenal auth #37

Merged
merged 12 commits into from
May 16, 2022
Merged

Conversation

duviful
Copy link
Contributor

@duviful duviful commented May 13, 2022

Hello.
I was able to add some lines in the configuration.py to enable tenant definition and selection.
Netbox requires to specify a different backend for tenants, I thought about linking my if to that one.

This is working already in my netbox-staging environment with our AzureAD tenancy.

Let me know if this could add some value to your role and feel free to ask for changes to align the code to your styling/preferences.

Best!

@jvoss
Copy link
Owner

jvoss commented May 16, 2022

Thanks! Looks fine to me for now! Would you mind updating the wiki for these settings? I'm not quite using Azure AD myself yet.

@jvoss jvoss merged commit 3f4b6ad into jvoss:main May 16, 2022
@duviful
Copy link
Contributor Author

duviful commented May 18, 2022

I was looking for updating the Wiki but looks like I cannot fork and PR like a normal repo

https://docs.github.com/en/communities/documenting-your-project-with-wikis/about-wikis

I can send over a snippet to you, in some way...

@jvoss
Copy link
Owner

jvoss commented May 18, 2022

A snippet is fine. Can you post one in the comments here? I do not use tenant selection with AzureAD so anything short and descriptive about how to use it would be very helpful to others.

Thanks!

@duviful
Copy link
Contributor Author

duviful commented May 18, 2022

it's very simple, the basic scenario uses an implicit tenant for AzureAD, while in this one, the only difference is that you need to specify one. I would go with just an example like this:

If your app is linked to a specific tenant, see the below for a configuration example:

# host_vars.yaml

# Azure AD
netbox_remote_auth:
  enabled: True
  backend: 'social_core.backends.azuread.AzureADTenantOAuth2'
  azuread_oauth2:
    key: 6eabe82b-731e-40f0-bc40-80798f5e1021 # APPLICATION_ID
    secret: X_X7Q~6Cp4XX1ZHVHGxqoM2w.q1prQ    # SECRET_VALUE
    tenant: dfa9dfa2-6ag3-4ddf-9v1c-9622b54ded7a # TENANT ID

  # Optionally force the use of an HTTPS redirect URI
  # (see the official documentation for more information about this option)
  # social_auth_redirect_is_https: True

This link will show how to find your tenant ID
https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-how-to-find-tenant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants