Power Apps: Add a User using Azure AD Connector

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is daniel and in today's video i'm going to show you how you can add a azure active directory user using powerapps so one of the neat things i want to tell you right off the bat is that the connector that i'm going to use is a standard connector so this is not going to cost you any extra money over here and then what i'm also going to show you is that when you're adding a user it will first check to see hey does this user already exist and if it doesn't then go ahead and add so before i go ahead and walk you through how to build the app i already have a demo ready so let me go and show you that but first here's my intro [Music] as a full confirmation about those connectors so best way to see a connector at least for me is i go to the power automate over here go to home and i go to connectors and in the connector area over here i go ahead come on yep right here and i go ahead and do a search for azure 80. and it goes ahead and tells me these are the azure 80 connectors that you have but just to be 100 sure i go to all connectors and i change that to standard connector and as you can see the azure ad connector the one i'm going to use is a standard connector which means you can do everything i'm going to show you with your office 365 users license over there all right so just thought i'll go ahead and take care of that right off the bat so next thing i want to do is i want to show you that demo one that i already made so i'll come over here to my test tenant and i'll go ahead and run the app so the app is loading and i just call it as an azure 80. um i went ahead and built this as a portrait size form and i built it for the the tablet one you can go and build this for a mobile one as well but just for the sake of this demo that's what i did so the first one i'm gonna do is live demo and then i'll put in the number over here as uh one five five five one two three one two three four again one one two three five five five zero nine eight seven department innovation technology job title power platform smee office location i will put that as redman and then enable account now yeah i can go into that as yes and so what had happened is while it was running over here it went ahead and even validated to see hey everything is good and uh it even gave me the check over here that uh you can go ahead and use it if this was an x which i'll show you in some of the other demos um it'll go ahead and hit sub the submit will have in fact let me show you that right now so first thing is i go and hit submit and once the submit is done let me just make the name get the name it's live demo so let's come over here let me refresh my and what i did was i've logged into the um azure the portal over here and in the portal when i come in i've gone into azure active directory gone into users and just to make sure i got the name correct it is live demo so i type that in live and right here i've got that live demo that's the one i just built i built it in powerapps and as you can see it directly goes ahead and adds that user to azure id but what i'm going to do is i'm going to continue and do another demo so let's just say that i come in and i just you know start typing in everything like the name i'm you know going and typing in every star everything and i put in demo and as you can see now two things happen that changed to an x and the submit button went ahead and disappeared so what it's telling me is that you can't use this because this user already exists so what i'll do is i'll just go and change that to two and it went and validated it says yep you have the option to add this user and now the submit button is there so i click on the submit button go back into the azure user i'll just refresh that and as you can see the second user shows up over here so if this has you know caught your attention uh let me now show you how i've gone ahead and built that right i'm going to build it from scratch so let me just grab this section over here so i can reference it yep that's the one let me go and just keep that over here um and now we come and start building a new one so i'll create here it's going to be a canvas app so don't forget about that and i'll do again another tablet layout and i'll try to do a portrait design as well but first things first never forget go ahead and save your app so i'm going to call this as live demo azure ad ad employee and come to the screen orientation i'll change that to portrait i'll keep everything else as this and i go ahead and apply it so i come in here and first thing i want to do is i've got to come here and i'm going to go ahead and add my connectors so the connector that i need is azure active directory so i'm going and if you don't have it then you can come over here to see all connectors and then you can go ahead and add a connector so you can go and take care of all of that in this entity and specifically in this environment i have already got this all done over here so come back here and in my connectors i'm going to click on it select that and it goes ahead and adds it so i've already taken my connection over here so now let me go ahead and start adding some controls over here and you can see that i'll uh um you know that's those are the fields i want to add so i'm not going to make this look as fancy as the demo that i showed but at least you can see what is going on right so the first one is i'm going to come here and call this as the first first name and i'll change that take the input out and the hint is add first name that way you know what's going on okay next do control c control v and it says add last name now remember in a active directory you will also hear this as a terminology surname um i've just gone ahead and said add last name over here but remember when it comes to active directory it's also called a surname all right let me keep going on and now next thing i want to do is i'll call this as the mobile number so and if i come and mobile number and i'll give an example it's a one one two three five five five one two three four just give an example over here change that to uh and this is going to be mobile number ctrl c ctrl v go ahead and cut this is add business number and it's important that you change the variable names i mean the control names over here because that is going to help you with that final formula that we're going to use over here all right keep going on i need to add three more so i'll just go and do some copying over here ctrl c and i'm going to copy these three over here let's start from the bottom one this is going to be the business i already have the business phone number so this is going to be department add department department next is job title and job title change that job title um and then office location and office location now the reason i'm doing all of this is to show you that hey these are all the attributes that i can add um one of them actually and that's the business number there's a little bit of a workaround that we have to do over there and that's why i wanted to show you how that happens as well so and then i can also there's the option to enable account for enabling account i need to add a label so that way you can just see enable account label and i'll say over here enable account now put that in so you can see that and i'll go ahead and add a radio button not radio a toggle switch that's what i meant toggle one toggle control enable account toggle for the toggle i'm going to make a little bit of a change what i'm going to do is i can either do it here i'll do it over here is the um true or the false text is going to be no and then the true text is going to be yes true text so i took care of that and then after this i want to actually go ahead and add some more controls that way you can see how the information is going to be um loaded and it's important that we put that over there because that's also how i will capture to see hey does this active directories uh use a profile or the technical term is upn does it already exists over there all right so i'm going to go ahead and now add some verification controls and there's actually only three of them so let me just capture these three ctrl c ctrl v and what this one does it helps verify so this one is going to display me the name the actual display name because the reason i want to display the name is because we're adding the the first and the last names individually i just want to show you together this is what the name is going to look like and so for that it's pretty simple i'm going to go ahead and say the display names default is going to be this way dot text and there there and last name what happened here surname all right i put that aside let me just change that last name that way i'm not confused okay so that should take care of that now this one is going to be the place where i show the users and email address that will be gone ahead and um another email ads it's gonna be the nickname um nickname is an option available in azure ad so i'm gonna just go ahead and show you how that can be done as well so it's called mail nick name and the male nickname is actually the exact same as the one we did over here so i'll go ahead and copy that and paste that over here and then the final one is the upn name and that is again very similar but we've got to go ahead and get our at you know the after the act and the company name so here i'm just going to go ahead and change that to a dot and then also add and here will be the at and then your company name so what you have to do is you got to make sure you know what that company name is in my case it is the at m365x one three six five four two at onmicrosoft.com but yours could be at and then whatever else is dot something so make sure you get that correctly um so i'm gonna make sure that since i haven't made any mistake in the typo i'm gonna already copy one that i have it pre-typed what does it okay there's two over here so you went ahead and put that so this is basically what it does um i'll also add a button because the button is where i'm going to go ahead and hit submit we'll work on the button a little bit later i'll just put the submit button for now submit let me also make sure i get these correct over here so this is going to be the user principal name prince co name uh this one is the it's not the mail name yeah it is the mail name so we pretty much got that over here now i want to move this out a little bit because i'm also going to do a verification check verification to see hey is this one um you know is it is it the actual way that it will work so see okay um icon i'll go ahead and add this one here it's on the top let me go grab it down right here and i'll call that as the yeah just the icon all right i guess there was already one so we'll just keep that as icon over here okay um so all said and done we've at least got all the the canvas section built over here at least the look and feel of it and we've gone ahead and added all the controls um now let's go ahead and start working on some of the formulas that we need so for the first one over here as you can see i already went ahead and added that default formula so that's good this one also default formula that's also good and then we've taken care of that now what i want to do is in this case when i come here i want to check and see hey how does that verification work over here so in the verification on the azure ad there is a function called azure 80 get user now there's a little bit of a trick to that what the get user does is it first of all goes ahead and takes whatever is the existing user that you have sends it and say hey return me the id of this user that's what we're doing if the id comes back as blank that we know then we know that hey this user doesn't exist so that's basically where we're kind of playing around with power apps over here um we're just assuming that hey power apps this user actually exists go ahead and get me the id id comes back blank and that user doesn't exist but we kind of already knew that you know based on the testing that we're doing so we're kind of working around the system oh yeah but it works really well now there's one catch and i'll talk about that catch at the end nothing to be over concerned about uh but it actually happens so let me go and now first before we go and play around with this one let's put the actual submit button and i want to walk you through that over here so in the submit button or on select over here we're going to use the function called azure ad and the 80 it has the create user so you start typing in and it's the create user now in the create user over here if you start if you type that in you see that there is a certain amount of attributes that you have to put over here now there's a limitation on these attributes and i'm going to kind of walk you through by filling up all of these and i'll even show you which one of the attributes you can't do so in the account enabled the account enable is pretty much just a true or false and so the account enabled they're going to get from this toggle switch basically what i'm saying is that hey i want to go and create that azure ad account but you want it enabled um so i'm giving you the flexibility over here that you can already go and create the account but it's not enabled over here or you can go ahead and create the account and go ahead and enable it giving you both the options over here and i like that the create user function also gives other options so here i'm going to go ahead and grab this toggle switch and that's what it's going to be dot um value so we took care of that one next one is the display name so the display name over here is the exact display name that we've got over here see that that's why i went ahead and did this little concatenation one over there so now for the display name i'm just going to go ahead and grab that dot text and the after that i've got the mail nickname well we already know that the male nickname is right here let me go and grab that put that in and dot text so we've got the mail nickname now the next thing that we need to do is the password over here the password is kind of very interesting what we have to do is we're going to tell azure id that when you're creating this account here's the temporary password that i already want you to go ahead and assign over here but over there i want to make it such that when the user logs in well for the first time the user logs in he or she has to use this password and that's the password we're setting up over here but i also want to go ahead and add this extra security function that when the user logs in he or she absolutely has to change the password we need to force the change of that password over here and that is what we are doing over here so what i'm going to do is i'm actually going to go ahead and now change that to a different line so it makes it easier and this formula needs to come inside a brackets now what i'm doing over here is actually not shown in this syntax over here uh that's why i kind of wanted to walk you through that this is how you do it uh because this is the only way that it does you got to put that on set inside the curly brackets and you got to go ahead and put these attribute names over there and that's the only way this works that's why i want you to work i want to walk you through it now this password that i'm typing in is hardcoded which means you also have to type in over here this is not a variable or anything that i'm picking up you've got to type that in over there just like that password maintain even the case sensitivity it all has to be lowercase it is very picky so do exactly the way i'm telling you is that that needs to be typed in that password needs to be typed in and then after that you can put in whatever else you want as the password so i'm going to put this in um as my password one two three four five whatever is the password i'm putting in but that needs to be there and then after that you've got to go ahead and type this in as well it's called force change password next login again this is very case sensitive and it needs to be the exact same way i've typed that in over there so make sure that you see that very closely as you do that and for that i'm going to leave that as true all right so we're moving forward and then the next thing that i want is to use the principal name the user principal name is coming from here so that's pretty easy gone ahead and grab that put that in dot text and we're good moving along um yeah so now that it's interesting because now that i've put the comma over here and i've already gone through and put this it shows me the remaining amount of things i can add in over here now let's focus on that first of all the added functionality of all the attributes that i can put in wasn't available before it's only after i put in that user principal name did it tell me that oh by the way you can go and put all of these other things in but these other things they also have to be put inside these curly brackets over here and then you've got to go ahead and make sure that all these other names are there now if you notice that after this preferred language text there is no dot dot dot what that means is that these are the only attributes that you can go ahead and put in over there now trust me when i said that i actually did try because i went amended the azure ad and i looked at the you know the docs of that and i saw that these are all the other attributes that are available you know things such as cell phone number and and so on and so forth they're available however through this connector it will not accept them it actually starts giving you those quickly airlines over there so right now as we stand these are the only attributes that you're allowed to put in through the powerapps connector over here right i mean still it is huge because you're able to go ahead and create a full connector i mean full user directly directly from a powerapp using just the standard license over there right you could just build that as a mobile phone and it works over there so this itself is huge now what i'm telling you is by no means a negative thing i just want to call that out all right so uh let's do the first one it is the given name again type it exactly the way you see it over here nothing that you want to change but just the exact one right so i'm going to do given name and my given name over here is that given name means first name so let me go ahead and grab my first name which is right here when i click on the first name and if you've noticed i do this a lot i just double click on it gets highlighted i do a control c and that way i've gotten the name the reason i do it this way is that for whatever reason if i did have a typo over here then i'm not wasting any time in my formula trying to type and say oh what was the name of my first name or is this not working that's because i made a mistake i went down and made a type over there so just to eradicate in any time wasted over there i just go and double click on this and then i control see it so hopefully then this helps me hopefully it will help you as well all right did that and i go ahead and grab the text as well and so far it is working so next thing is sir name which is also last name so let me type that in do the exact same that you know how i do it is i come over here last name double click ctrl c go back here and pasting it so far it is liking everything i'm doing because i'm not seeing any squiggly lines or any yellow squiggly lines which means it is moving along next thing that i have is um business phones i'm gonna skip business phones for now because as you notice it says business phones table so i'm gonna wait to talk on that but let's switch that and come to department again it doesn't have to go in that order i can always do something else but for now i'll just skip business phone then we'll go to department department again here click on that double click control c coming back dot text and we've got what else we've got job title so j o b the j is lower case but the titles t is upper case so i'm making sure i do that correctly as well the job title is here ctrl c i'm making good progress moving along what else do we got what else do we have job title um phone i mean the mobile phone that is just a text so that should be pretty straightforward um so it's mobile that's why i'm not skipping that that one the mobile phone like i skipped the business one business one the reason i skipped it because it's asking table and i'll deal with that in a second but the mobile phone is just a text so i'm gonna move i'm gonna move along for the mobile phone too many moons over there phoned text so you've got the uh mobile one so you can go and grab that pasting it back here dot text and we can still you can go ahead and add now uh what else department job title mobile phone all right so now let's go ahead and focus um and i could put in the office you know i yeah let's put the office location i can get the office location from right here missed that one so we just get the office location and get that also done okay so now let's focus on the mobile one on the business phone so remember it says business phones so it's doing plural so let's attempt to do it the same way as we did for the mobile phone so i'm going to type in business business uppercase p phones and let me just go grab that business phone and see what happens that's the business one double click ctrl c come back dot text the exact same way as i did for the mobile phone but it didn't doesn't like this over here um in fact the error is kind of um misleading but what it wants is it says this is the answer this is how i figure it out it says it wants a table of some kind to put this over here now as you all know i am not a big fan of powerapps tables in fact i use it very rarely i personally go with only using galleries and i can make a gallery even look like a table tables just have been a little bit challenging and i run into a lot of limitations i'm my when i saw this table i think oh man do i have to use a table so i said well you know what i'm gonna try with the gallery let's see how that works and i'll tell you it actually worked really well so what i did is and i'll show you what i did is i went ahead and on the submit button itself i did two things i went and actually created a gallery and then in the gallery i'm basically taking that text that i have this business phone text i'm adding it to the gallery and then in the formula for add user i go ahead and get the first value of the gallery let me show you how that means i think you get it let me show it to you so on submit right on submit over here i'm going to now go all the way to the top because that has to be the first thing and right on top i put in and just let me know i put the semicolon ahead over here and i'll do a clear collect remember create collect means i'm going to go ahead and make a collection and i'll call this one as buss business phone collection and then here i can go ahead and get the actual text for the business phone so i'm going to grab that ctrl c and come back over here and i'll paste it in dot text and then i can go ahead and actually close that now i come back over here and i grab the first one say first and then it already tells me intellisense already says that these are the only two options you have so i go and grab that one close it and voila the error goes away and another thing is i didn't use the table i actually went and used the collection um and because the collection in the galleries i kind of you know said them as the same thing but you know what i did i did not use the table i went ahead and just used um that collection over there and it works really well the key thing is you got to do a clear collect don't miss that it's just got to be a clear collectors if you just do collect you're going to keep adding more and more phones over there of a business phone number so make sure it's clear collect and then put it way on the top right there is the first thing that happens when the button is clicked and then in the business phones over here that's where you go ahead and hit um uh the uh uh you know that's where you go and uh add the number over there now we're almost done what i want to do is i want to focus on this guy over here so what i'm basically saying now is that hey i want the icon um yeah that's fine i want the icon over here to remain first of all as a check um if i'm you know i'm sending the value i'm sent whatever is the existing name over here i'm going to go ahead and first do a get user i'm going to check against active directory and saying hey does this already exist if it comes back and says no it exists which means the is blank is not false then it'll go ahead and tell me um that hey that is you know it is there which means go and change that check to go uh go ahead and make it as a x over there that's basically what i'm trying to do so let me show you okay the formula that i'm going to do is basically i'm adding a if if and then i'm going to use the is blank is blank and let me actually go ahead and just put a comma over here and i'm saying if blank azure ad dot get user it's get user and then what user am i referencing i'm referencing this one so i'm gonna go ahead and get ctrl c ctrl you know ctrl c over there and then i come back to this formula and i'm going to put that in the get user that i'm doing i want you is this name over here whatever is the name that gets auto-generated based on everything that i type go ahead and take that name and use it in the get user function and tell me what it returns so i put that in over here after that i'm telling send me something if the user is there and if it's not blank send me something so what i'm saying is i'm going to go ahead and just send me the id right it says send me the id and i go in and say if it's false if it is false then keep the icon check as uh cancel because what i mean is that if it goes ahead and sends something um and if the user uh doesn't exist i mean if the user already exists then say that hey you can't use this because it's cancelled all right so that's what i'm doing i'm gonna get put that as cancel or you can even go ahead and say icon cancel whatever works for you so i actually already had icon that's why i selected cancel otherwise go ahead and say icon dot check all right received three expected ones let me just stop this for a while and we'll go ahead and do a full test and we'll see because we are actually done as far as building it and if that may not be working it's because we haven't done anything to it yet so let me just do a full test and then we'll see what happens all right so let's now do a test first name i'm going to say um what was the one i used before over here it was live so i'm going to say test demo and over here is mobile number so i'm going to say 1 5 5 5 0 0 1 one two three four and i'm gonna try to do the same thing with the mobile one as well a business one one five five five zero zero zero one two three four department innovation technology job title power platform um export location i'm going to basically say we are in redmond i want do you want to enable the account i said yep i'll go ahead and enable the account and it already went in and generated the name which is test demo over here remember that's the user's display name uh job title that should have been actually the user's mail so let's see what we missed over here all right i think we should have just copied it and pasted it probably did not that's what happened so i'm going to click submit let's see what happens it is going through went in successfully it's a test demo so if i re let me just change that refresh if i type in test oh because i need to put in the double quotes over here missed that so let's try that again it was test demo let me hit submit yep it came through the test demo that's the one i just built but let's go and check over there the test demo i went down and put in all the information is coming through including the phone numbers the redmen it all came through over here but now let's go back in over here and just say i'm going to delete this test i'm going to type in test and now let's see what's happening so it's some reason it's not liking this let me just go ahead and say on the icon let's just wipe this off and try this again so if is blank azure a d dot get user and the user's name we're getting is actually the principal name which is this one here principal name it's text i'm going to close that get its id close it over here equals false then go ahead and get me the icon dot cancel otherwise get me the icon dot check close it there you go it's working now well i'm not sure what happened but we went and typed it through so let me just tell you what how this is working now we are going to go ahead with making the attempt to go and create another user but it's saying that that test demo already exists which is why i'm not going to allow this over here what you also want to do is you want to go ahead and make that submit button invisible and with the submit button invisible you take basically the same formula that you have over here literally right up to this false go ahead and copy it prefix over there in that submit you come to the submit button you go to it's visible and in the visible you add the intent like 90 of it is the exact same thing except now you say that if it already exists just go ahead and hide it and this is what happens because this already exists i'm completely avoiding the option to go ahead and even save it that user proof is what i'm making over here but if the user says you know what this is already there which means let me just change that to test demo to test demo say two then it changed it in fact you notice when i put testimony it said yes when it has demo two it said yes because what it did is it went in and saw that this is the entire upn name over here it went ahead and validated that through azure 80 using the azure ad.get function so that yep this one there's nothing over there which means you can go ahead and create that now what's happening is you're getting these errors and don't be alarmed by these errors let's take a look what it says it basically says that this user right over there on the site says it does not exist or one of its query reference properties are not present which is exactly what we're looking for we wanted it to tell me that hey does this user exist over there and it's giving me an error saying that the user doesn't exist which is perfect because if the user doesn't exist only then and we're going to create the account with that upn name over there um so it works but unfortunately we get the checks over there the error message for this case this scenario go ahead and ignore that but so now if i go ahead and click on the test demo 2 click on test demo 2 finishes i'll come back to all users over here in fact i refresh it and now you can see there's my test demo too right there come back into my azure id i mean my powerapps i want to try to say let me create this test demo too it's like nope still it already exists over there and it went and hit the box over there so this is a fantastic way to go ahead and now through powerapps using a standard connector you can go ahead and directly add users into active directory that's one thing i mean azure active directory and you can even go ahead and say hey i want it enabled or disabled you can even have that functionality over here now like i mentioned before i do want to call out that there are very limited attributes that you can put over there so the only things the big ones that we could not do um or the minor ones that we could not do was you know put in like the state or the country and things like that there are other ways to do a workaround for that but i wanted to focus only on the power apps the same thing happens even on the flow side because if you if you know if you go to the power automate there is actually a connector and a function already available if you go to connectors over here it's going to the connectors i'm not connectors templates you go to the templates and when you search in the templates for azure ad this azure id click a button to create a new azure id user this is already there and it's pretty neat but it did not have the functionality that i showed you where you can go ahead and even validate hey does this user exist it doesn't have that functionality over there also if you can see it doesn't have all the other functionalities that you know it it has office location but i wasn't able to go ahead and put in the city and the state and all that so the limitation that i'm showing you is not just on the app set it's on the power automate and it's neither one of the two faults it's the connector the connector's got the limitation but still this is pretty neat i mean what i've shown you is right from your phone you can start creating these azure ad users with a standard connector so hopefully this was helpful if you've got any questions go ahead and add it in the comments below and i'll do my best to answer them otherwise keep power wrapping you
Info
Channel: Daniel Christian
Views: 6,205
Rating: 4.9578948 out of 5
Keywords: Power Apps: Add a User using Azure AD Connector, Daniel Christian, powerapps tutorial, Power Apps Standard Azure AD connector, azure active directory, power platform, powerapps azure ad connector, powerapps azure ad connector examples, powerapps azure ad connector getuser, powerapps training, power apps, PowerApps Azure AD function, PowerApps Canvas apps for Azure AD, Power Apps Azure, PowerApps with Azure AD, powerapps tutorial step by step, powerapps tutorial for beginners
Id: RE8WqZI8G4o
Channel Id: undefined
Length: 38min 37sec (2317 seconds)
Published: Mon Jul 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.