Django and Azure Active Directory - Outsourcing Authentication to Azure AD / Setting up MFA

Поделиться
HTML-код
  • Опубликовано: 31 янв 2025

Комментарии • 80

  • @phillipgilligan8168
    @phillipgilligan8168 Год назад +1

    This is legit the best explanation I have seen and gave me confidence to implement this in my project. Thank you, as well for the technical breakdown, that was so useful!

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks a lot, really glad it was useful! Thanks for watching!

  • @trosgate
    @trosgate Год назад +11

    This is dope. I love your channel for high level programming.
    1. I am hoping that we could go a little bit further to configure multitenant applications too
    2. In multitenant applications where domains might be unique and dynamic, how is the auth gonna be like?
    Until then, thumbs up from me

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks a lot for watching, glad you're enjoying the channel!
      Nice suggestions, I will consider these options!

  • @yomonsbuzz4978
    @yomonsbuzz4978 Год назад +1

    under rated
    u deserve subs brother
    keep it up quality contentment

  • @LIKITHBR-o1z
    @LIKITHBR-o1z 6 месяцев назад

    explained it very well,
    Thank you so much for your knowledge sharing

    • @bugbytes3923
      @bugbytes3923  6 месяцев назад

      Thank you! Glad it was helpful!

  • @tlpf666
    @tlpf666 8 месяцев назад

    Thank you very much, very clear, very pleasant to hear.

  • @nicholas_eras
    @nicholas_eras Год назад +4

    What about django rest framework. My frontend is running on another server so I need to send the office365 uri from the backend, then i need to validate de token from the frontend

  • @piyushsonawane1861
    @piyushsonawane1861 Год назад

    Thank you so much sir ....very well explained ....love this video

  • @BrantScalan
    @BrantScalan Год назад +2

    This is a great video. Is there any chance you can talk about group claims and some of the other parameters so that we can map AAD groups to Django groups and permissions? It would be super helpful in implementing a true single sign on of Django with AAZ

  • @BrantScalan
    @BrantScalan Год назад +2

    This is great content as usual. Do you have an example of, or could you create/show, how to use AAD groups and claims with Django groups for permissions and content access? It’s one things to SSO with AAD but in reality members of AAD groups would have rights that needs to used for Django content

  • @peterevance
    @peterevance Год назад +2

    Thank you very much!

    • @bugbytes3923
      @bugbytes3923  Год назад

      You’re welcome, thanks for watching !

  • @aalhommada5675
    @aalhommada5675 10 месяцев назад +2

    Thanks for the Explanation , I hope that you can add an update about the Azure Entra ID.

    • @THEATEAMRULES
      @THEATEAMRULES 9 месяцев назад

      much needed

    • @THEATEAMRULES
      @THEATEAMRULES 9 месяцев назад

      did you find some resources about it?

    • @aalhommada5675
      @aalhommada5675 9 месяцев назад

      @@THEATEAMRULES I think if you understand AD , it will not ne difficult to get EntraID , it is kind of update

  • @grant4458
    @grant4458 Год назад

    Great video. Thanks.

  • @charlesu49
    @charlesu49 Год назад +1

    Excellent video!!! My question is, how do I access the users' other information like their email address? Seeing as request.identity_context_data provides username but no other personal information. And I will really appreciate a pointer on how this can be combined with a User model.

    • @pedrozuffo9516
      @pedrozuffo9516 Год назад

      You can get more information by using request.identity_context_data._id_token_claims

  • @mice1973
    @mice1973 Год назад +1

    Very interesting.
    But if I need to give authorization via /admin, how can I make this directly via AD?

  • @creepersonspeed5490
    @creepersonspeed5490 Год назад +4

    Sadly they have now removed the json sample from the tutorial...

  • @BrantScalan-y9c
    @BrantScalan-y9c Год назад +1

    Amazing video. Something I have wanted to do was convert my project to SSO against Azure AD. Could there be a follow on video about django permissions and Azure Groups and Group Claims in the Azure token? That is one road block I have for conversion. How do I protect content, model perms, with members from azure groups or mapping them to existing Django groups. Not sure how to do that or what should be done. Thank you

  • @routchenko
    @routchenko Год назад +1

    great video, just to round up, if you could just do an extension of the media file in azure storage would be lovely

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thank you Sacha! Yes, I'll do a video on storing the media files in Azure Blob storage soon.

  • @arjunpa8648
    @arjunpa8648 11 дней назад

    The documentation link provided is now redirecting to azure ad for Flask application instead of django

  • @dinesh1782
    @dinesh1782 10 месяцев назад

    Great work,Can you please comment the documentation link which you followed

  • @SkeechFab
    @SkeechFab Год назад

    So good thx! What's the baseline pricing for adding Azure AD to Django?

  • @abhishekkaushik1635
    @abhishekkaushik1635 Год назад +1

    Hi, really nice tutorial. I have been following this tutorial & it works smoothly. But I am trying to add Azure AD to an existing DJANGO APP (created by someone else). whenever I am trying to login using SSO it reverts me back to LOGIN page. My guess is I am missing something & "request.identity_context_data.username" under HTML page is not woking as it should, hence reversing to login page. Can you please provide any advice on this or we test my theory of "request.identity_context_data.username" within app.
    Regardless, great video, you have one more subscriber.

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thanks for subscribing - really appreciate that!
      I'm not really sure, but a few things to check:
      * have you configured the redirect URI on Azure? It * In your view, what is the output of logging "request.identity_context_data"?
      * Are you using the ms_identity_web login_required decorator (and NOT the standard Django decorator)?
      I'd also make sure you've added the code at the bottom of this page ("Sign-in to a Django web app" section):
      learn.microsoft.com/en-us/training/modules/msid-django-web-app-sign-in/4-sign-in-users-to-django-web-app

    • @abhishekkaushik1635
      @abhishekkaushik1635 Год назад

      @@bugbytes3923 Thank you entertaining my query, I will proceed with your comments. One last thing, is it necessary to do HTTPS thing? I mean I followed your example it is running fine without that, not sure why it is required

  • @Johnnysus
    @Johnnysus Год назад

    Love your videos.
    How would you restrict certain views to different users within your tenant (i.e., supervisor views vs associate views)? Can this be done using Groups in Azure, or would you want to use social_auth and add to the social pipeline (which creates a user model in django database)?

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thanks John!
      Interesting question. With a User model, you can leverage Django permissions to restrict certain views, depending on permissions assigned to the user (or a group). The "permission_required" decorator can help you here.
      It would also be possible to do this via groups in the tenant. When you receive the response with the identity_context_data, you can look at the group(s) the user belongs to in the Azure AD tenant. You could then write a Python function and pass that to the "user_passes_test" decorator to restrict certain views. More on that decorator here:
      docs.djangoproject.com/en/4.2/topics/auth/default/#django.contrib.auth.decorators.user_passes_test

  • @XEQUTE
    @XEQUTE Год назад

    1. how would you do the same with flask ??
    2. also , flask vs django , is it really just micro framework vs a more robust one?

    • @bugbytes3923
      @bugbytes3923  Год назад

      I've not really looked into Azure AD with Flask, but the library used in this video - ms-identity-web - can also be used with Flask.
      A sample repository is here: github.com/Azure-Samples/ms-identity-python-webapp
      Flask is a smaller framework as it offers less out of the box than Django, but you can add the utilities you need when you need them (forms, database connectors, etc).

    • @XEQUTE
      @XEQUTE Год назад

      @@bugbytes3923 Thanks for the reply !
      Unfortunatlyey , the library cannot be used with conda ( to my knowledge , as its called azure-ilengthy dentity and the sample code uses Identity package )
      I tried making an app with it ( quiz app ) but I can sign in with microsoft accounts too , but I get a code in return which I dont know what to do
      I set the client id , secret n all too.
      Lend some advice if you have some.Thanks in advance
      :D

  • @weixiangng8279
    @weixiangng8279 4 месяца назад

    How you check the permission of the new user you just set?

  • @AlbertSico
    @AlbertSico Год назад

    I'm having a hard time operating the sign_out ! My app will work fine in a private browser, but not on a browser. I'm guessing the cache isn't deleted, or something so... I don't get redirected to the app after logging out with Azure AD. Any advice with this?

  • @wearerunnersw.a.r5613
    @wearerunnersw.a.r5613 Год назад

    Great video. For some reason I had the ff issue: Django - Reverse for '' not found. '' is not a valid view function or pattern name
    I managed to resolve it by creating index and home views and urls.
    Do you know what could be the case?

  • @kirteekumari3459
    @kirteekumari3459 Год назад

    Hi i am stuck at a part in the video, can it be possible because i only have a free account and free credit? Do i need to have a pay as you go pricing for getthing this done ? because it is not giving me the option to create a Entra ID with free subscription

  • @peterholzer98
    @peterholzer98 Год назад

    Excellent as always!
    When I deploy to Heroku or Railway I use to save the credentials in a .env file which i don't save to Github. How should i handle this with the aad.config.json file?
    It would be nice with some examples using MS Graph API as well. Thanks a lot!

    • @bugbytes3923
      @bugbytes3923  Год назад

      Thank you for the suggestions Peter! Will look into the MS Graph API.
      For your aad.config.json file, definitely don't check the raw values into Github, as it contains your app's client secret which shouldn't be exposed.

    • @peterholzer98
      @peterholzer98 Год назад

      @@bugbytes3923 I understand that but how would i store and retrieve the json file in a Heroku env var?

  • @izao.00
    @izao.00 Год назад

    is it possible to use this technique with django rest framework?

  • @monikasingh000
    @monikasingh000 Год назад

    @bugbytes I applied Active directory login system in my django application and deployed it in Azure portal app services. It works fine for 1st week but then suddenly it start giving error "AuthSecurityError at /auth/redirect Failed to match request state with session state". I am using azure sql server as backend without creating models. Can you please help me to find out and resolve this issue?

  • @akabane32
    @akabane32 Год назад

    Is this library ready for production?

  • @KTInfotech
    @KTInfotech Год назад

    What if i am using deployed django app in azure webapp then what redirect URL i need to you?

  • @jiya9643
    @jiya9643 7 месяцев назад

    can you please make video on django and azure AD by SAML

    • @jiya9643
      @jiya9643 7 месяцев назад

      i was searching for video on django and azure using SAML,
      I saw this very informative, Thank you very much.
      Please do make video on django and azure using SAML

  • @rauleduardoavilamata4358
    @rauleduardoavilamata4358 2 месяца назад

    Is there any way that I can contact you directly to help me with my implementation? I'm really really stucked because i'm changing the application flow that was already implemented and i've tried everything.
    It doens't matter if you charge me for the meeting

    • @arjunpa8648
      @arjunpa8648 11 дней назад

      how is it going? have you managed to integrate azure ad authentication

  • @mr_don_key
    @mr_don_key 8 месяцев назад

    request: could you redo this video with the current way of doing this? (the json variant is taken offline by msft)

    • @bugbytes3923
      @bugbytes3923  8 месяцев назад

      Thanks - yes, I'm planning to as I've had some requests. Will do this over the summer at some point.

  • @frameff9073
    @frameff9073 Год назад +1

    thank

  • @rorisangsitoboli4601
    @rorisangsitoboli4601 Год назад

    Great work. Could you share your code please. I am trying to reproduce the entire tutorial but am failing to get the 'You are not signed in. Login' part. At least with your code I can investigate easily where I made mistakes and remedy that. When I run the server I just get the 'Hello World' text i intended but no 'login' option/button.

    • @bugbytes3923
      @bugbytes3923  Год назад

      Hey, thank you for watching. I'll try and get the code online today - will drop a message in here when it's available.

    • @rorisangsitoboli4601
      @rorisangsitoboli4601 Год назад

      @@bugbytes3923 Thanks. Will be grateful for that. I really need to master this concept for a project.

    • @rorisangsitoboli4601
      @rorisangsitoboli4601 Год назад

      @@bugbytes3923 Good day. Any progress?

    • @bugbytes3923
      @bugbytes3923  Год назад +2

      @@rorisangsitoboli4601 Sorry for the delay. You can find the code here:
      github.com/bugbytes-io/azure-ad-django-demo

    • @rorisangsitoboli4601
      @rorisangsitoboli4601 Год назад +1

      @@bugbytes3923 Good day. Apology unnecessary. I appreciate your kindness in sharing this valuable information. Thank you much.

  • @worldpug
    @worldpug Год назад

    How can i add a profile for the user

  • @pratikcharwad
    @pratikcharwad Год назад

    Azure Active Directory is now Microsoft Entra ID.

  • @ramlakhankevat2666
    @ramlakhankevat2666 Год назад

    Please give me a Azure django sso documentation link

  • @Akometer
    @Akometer 5 месяцев назад

    Documentation link pls

  • @LahariBale-u3e
    @LahariBale-u3e Год назад

    This video is great! Could you help me out on how to extract user PROFILE PICTURE from azure ad? The following code doesn't help me extract user profile picture: request.identity_context_data._id_token_claims
    It's URGENT, PLEASE help if any of you can...
    Thanks in advance!