Azure Active Directory : Bulk Create + License assignment / attribution via Powershell

One of my colleagues told me, how she struggles with creating 10 CRM Accounts everytime she has a new Demo(she does more than 3 a week). Plus manually assigning the licenses.

And as a hero i told her that Powershell is always the solution, so i wrote this script that bulk creates and assigns licenses.

This script creates Azure Active Directory accounts, that means it can be also used for Office365, SharePoint, CRM…etc

Azure Active Directory Powershell

The script uses the AzureAD Powershell.

First you need to install it on your computer by running this cmdlet :

Install-Module AzureAD

How to use it

Just download the 2 files and start the ps1 script.

Input.Json : input

Script : New-AzureADAccountBulk

Script Logic

The script’s Input is a file Input.json that provied those Infos

  • Tenant Name
  • Admin Login
  • Admin Password
  • List of Users to create
    • Display Name
    • Mail NickName(the email’s preffix)
    • Password
    • List of Licenses to Assign

License Names could be listed by running this command


License samples :



The Script

The scripts can be downloaded here. I changed the extension to pdf, because WordPress doesn’t allow ps1 and json extensions.

Input.Json : input

Script : New-AzureADAccountBulk

I will not go through the whole document, but i will comment the improtant commands.


$config = Get-Content .\input.json | Out-String | ConvertFrom-Json
#Reading the json file

$adminPwrd = ConvertTo-SecureString -String $config.AdminPassword -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $config.AdminLogin, $adminPwrd

#Using -Credential was to avoid the login popup
Connect-AzureAd -Credential $Credential


#Loading the License from Azure Active Directory. If license not found, a warning is displayed
$liceTemp = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value $license -EQ)

#check if the User already exists
$user = Get-AzureADUser -ObjectId $userPrincipalName
$user = $null
if($user -eq $null)
write-host “Creating User ” $account.DisplayName
#Create the User. -UsageLocation is important for the license attribution
$newUSer = New-AzureADUser -DisplayName $account.DisplayName -PasswordProfile $PasswordProfile -UserPrincipalName $userPrincipalName -AccountEnabled $true -MailNickName $account.MailNickname -UsageLocation DE
write-host “User Created ” $account.DisplayName -ForeGroundColor Green
write-host “User ” $userPrincipalName ” already exsitst. Trying assigning License”
if($licensesObj.AddLicenses.Count -ne 0)

#Set the license only if found
Set-AzureADUserLicense -ObjectId $userPrincipalName -AssignedLicenses $licensesObj
write-host “Licenses for User ” $userPrincipalName -ForeGroundColor Green


SharePoint custom fonts and styles

SharePoint is also considered as a Web CMS. Whether it is a Content Editor Webpart, a Rich HTML Field or a Publishing page the Ribbon offers formatting and design capabilities, which looks like all Office Products.


To make the redaction of articles easy and standard(in case of a corporate design) we can add both custom fonts and text styles to the ribbon elements, such Headlines, HR News…etc


We can add more fonts, which are either based on standard ones, or on custom fonts that you purchase. And it is very easy within SharePoint. You should just add some special classes to your loaded CSS.

You should just add a class definition named “ms-rteFontFace-XXX”, where XXX is a random ID.

-ms-name:”Gotham Book”;
font-family:”Gotham Book”;

This will add a new Font “Gotham Book”.

PS: the font files should be loaded using “@font-face”

@font-face {
font-family: ‘Gotham Book’;
src: url(‘path/GothamBook.ttf’) format(‘truetype’);



We can add preconfigured text styles, and here we will add a Headline with the font Gathoma Light, red color and with 30px size.

font-family:’Gotham Light’;
color : red;
font-size: 30px;