Skip to main content

Notifications

Power Apps - Connector Development
Suggested answer

I want to use Azure AD for authenticating users in Power Apps

Posted on by 17
Hi Power Apps Community,
 
Trying to find a way where i can create login screen and authenticate users using Azure AD so that i can show them different UI's based on internal user or external(guest) user. Can anyone help us out in a way we can achieve this?
Categories:
  • Suggested answer
    FLMike Profile Picture
    FLMike 23,361 on at
    I want to use Azure AD for authenticating users in Power Apps
    Hi,
     
    If you want, you can create a Screen, built as a login. Show this screen first to your users. Then, you can create an Environment Variable, that has a comma separate list of all the domains that would identify someone as internal
    Example: Environment Variable called 
    Internal Domains
    Value: me.com,you.com,davis.com,etc.com
     
    Now in your Login Screens OnVisible property you would read this Environment Variable and Split it by the , giving you a Collection with a Value property.
    Or you can instead do a 
    ForAll(Split(MyVariable, ","),
       Collect(MyDomains,
        {
            Domain: ThisRecord
        }  
      )
    );
     
    Now you can take the persons email and split it by the @ sign. Take the [1] index of the returned value so
     
    would turn into
     
    michael <= [0]
    me.com <= [1]
     
    So
    Now we want to check if that user is in our Internal list
     
    If(CountRows(Filter(MyDomains, Domain = Split(User().Email, "@")[1]) > 0, then we know they are internal
         They are internal,
          They are not because there were not items in the collection with their domain
    )
     
    P.S. You could also store the data in a SharePoint config list, or a flat file, whatever you want, I just used an Environment Variable as a sample.
     
    But now you know.
     
     
  • WarrenBelz Profile Picture
    WarrenBelz 140,745 on at
    I want to use Azure AD for authenticating users in Power Apps
    Hi vrush96 
    The built-in functions User().FullName and User().Email identify the logged-in user, so you simply need a reference list setting out what they can/cannot do.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 140,745

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,355

Leaderboard

Featured topics