“SPO licence” error using Graph API with Azure AD B2C
“This .NET Core console application demonstrates the use of the Microsoft Graph API to perform user account management operations (create, read, update, delete) within an Azure AD B2C directory. Also shown is a technique for the bulk import of users from a JSON file. Bulk import is useful in migration scenarios like moving your users from a legacy identity provider to Azure AD B2C”.
The commands are:
 Get all users
 Get user by object ID
 Get user by sign-in name
 Delete user by object ID
 Update user password
 Create users (bulk import)
 Create user with custom attributes and show result
 Get all users (one page) with custom attributes
 Get the number of users in the directory
[help] Show available commands
[exit] Exit the program
Enter command, then press ENTER:
Command “1” to list all the users only displays a few attributes so I wanted to extend it to display more.
// Get all users
var users = await graphClient.Users
.Select(e => new
However, when I ran it I got the error:
“Tenant does not have a SPO licence”.
Googling this, it seems that “SPO” stands for “SharePoint Online”, and you need an Office 365 Business account to have it. WTF?
I found that if I commented out some attributes as above, the error disappeared. Go figure!