Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

[Azure] Create a user with Azure Function

  • December 13, 2018
  • 4 min read
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.

https://i0.wp.com/cloudyjourney.fr/wp-content/uploads/2018/10/AzureFunction_Logo.png?resize=215%2C201&ssl=1

In the following 3 articles, we’ll see how to automate the user creation, with Azure Function, with a SharePoint Online interface and with a PowerApps application.

To start in this first article, we will see how to create our new user, with an Azure Function.

We will use the following PowerShell script for this demonstration:

As you can understand, you will need:

  • An Azure Function
  • An AutomationAccount application settings, in the Azure Function, with an account that has rights to the Azure AD to create new users
  • Create a Password application settings, in the Azure Function, with the password of the previous account
  • To switch your Azure Function Web App to 64-bit (in Application Settings)
  • Downgrading your Azure Function from version 2 to version 1 to use PowerShell because PowerShell is not yet available in version 2:
    https://docs.microsoft.com/en-us/azure/azure-functions/functions -versions

wp-image-10514

  • To create a new function, named cloudyjourney in my case, with PowerShell language and with type http trigger :

wp-image-10515

wp-image-10516

When you’ve all of these prerequisites, go in the Integrate part of your function, and select just the POST method that will be allow to receive call via the webhook (Mode) :

wp-image-10517

You can test your function, by clicking on Run and by using the following JSON code uin the Request body part, on the right :

wp-image-10518

Creation worked correctly :

wp-image-10519

And I can now login with my new user :

wp-image-10520

 

My script is working. Last point, in your function, click on Get function URL and get the URL that we will use to call our webhook in SharePoint :

wp-image-10521

In the next article, we will see how to create a list in SharePoint, to start automatically our Azure Function, through the webhook, from SharePoint.

Found Florent’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!