Create Azure AD User using Graph API & HTML Form

Copper Contributor

Hi there!


I have given myself a little project for the holidays. I'm dabbling in some ideas but I'm still very new at the developer side of things in the Microsoft Metaverse.

Some background about me: I'm a Microsoft Certified Azure Solutions Architect & Azure Security Engineer Associate. My history with MS goes as far back as MS-DOS :) I've been working mostly in the front-end side of things and only started in recent years dabbling with back-end and coding. I am by no means fluent in any developer languages but know my way around Powershell. I'm currently self-studying for the Azure DevOps Engineer Expert certification.


So on to my little project...


Basically, I want to create a User Signup form in HTML. The usual "First Name", "Surname", "Email Address", "Password" and "Confirm Password" fields. I've gotten this far and I have the submit button too. For the scripting I've chosen Javascript but suggestions are welcome on whether C# or another language would be easier / faster / better.

Now the part where I'm at a loss is how to pass the values captured in a form using Javascript to the Microsoft Graph API to create the user in Azure AD based on the values filled into the fields. I have created the Azure App Registration with sufficient permissions as per Microsoft Documentation. User.Read.All & User.ReadWrite.All

But I'm not at all clued up on how to create the Authentication Provider, Get the Access token etc. Can this be tested locally or do I need a web server? Right now I have a local HTML file that contains the form and a Javascript (.js) file with some code that I copied from Microsoft example documentation but I have no idea which values are supposed to be replaced with my values.

I would appreciate any help / hint in the right direction.

I apologize if this is the wrong forum for this. Feel free to point me in the right direction. :)


Thanks in advance!



1 Reply
Hey Louis

It is not what you asked, but why make it harder then it MAY need to be?

Take a look at Microsoft Forms and Power Automate

Can have people fill out a Microsoft Form, which then triggers a Power Automate flow to create your user, tons of information out there and may be a bit more supportable than a custom solution, just a thought!