OnCallReadyStart learning

Azure Lesson 32.1 · Azure IV: Governance, Storage & Backup · 20 min read

Microsoft Entra ID: users, groups, licences, guests and SSPR

In plain words

Entra ID is the company's staff directory and badge office. Every person has an entry (a user), people are put on lists (groups), some lists come with perks (licences), visitors from partner companies get visitor badges that work with their own ID card (guests), and if someone forgets their PIN they can reset it themselves at a kiosk after answering two security questions (self-service password reset).

Azure subscriptions trust this directory to know who is who. Access to things in Azure is a separate list kept in the subscriptions.

Microsoft Entra ID: users, groups, licences, guests and SSPR

Every Azure sign-in, every role assignment and every "who deleted this?" in the activity log goes back to one directory: Microsoft Entra ID (the service that used to be called Azure Active Directory). Azure I used it for groups and service principals. This lesson covers the rest of what an Azure administrator does in it every week: create and change users, give them licences, let people from other companies in as guests, and set up self-service password reset (SSPR). Without SSPR, password resets end up on the on-call engineer.

Need to know: the directory is a tenant (here sysoplab.onmicrosoft.com, id 11111111-2222-3333-4444-555555555555). It is not an Azure subscription: subscriptions trust a tenant for sign-in, and one tenant can hold many subscriptions. Users, groups and licences live in the tenant. Role assignments on resources (Azure RBAC) live in the subscriptions. Two separate permission systems:

Azure RBAC (Azure I)Microsoft Entra roles
Controlsresources: VMs, storage, Key Vault...the directory: users, groups, licences, apps
ExamplesOwner, Contributor, Reader, Storage Blob Data ReaderGlobal Administrator, User Administrator, License Administrator, Guest Inviter
Assigned atmanagement group, subscription, resource group, resourcethe tenant (or an administrative unit)

A Global Administrator can't read a storage account's blobs until they get an Azure role. They can give themselves one ("elevate access" to User Access Administrator at the root), but that is a separate, audited step.

Users: members and guests

$ az ad user create --display-name "Maria Ionescu" --user-principal-name [email protected] --password 'Lab-Passw0rd!2' --force-change-password-next-sign-in true --query "{upn:userPrincipalName, id:id}"
{
  "id": "b8f49115-f30b-4c6b-8ebf-338ae67ee618",
  "upn": "[email protected]"
}
$ az ad user create --display-name "Bad Domain" --user-principal-name [email protected] --password 'Lab-Passw0rd!2'
ERROR: Bad Request({"error":{"code":"Request_BadRequest","message":"The domain portion of the userPrincipalName property is invalid. You must use one of the verified domain names in your organization.","innerError":{"date":"2026-09-22T20:00:04","request-id":"3d12cc03-883e-448a-983b-40c8145c3aa7","client-request-id":"751ad91b-be5d-4664-8c72-67c59c30a362"}}})
$ az ad user list --query "[].{name:displayName, upn:userPrincipalName}" -o table
Name           Upn
-------------  --------------------------------
Learner        [email protected]
Maria Ionescu  [email protected]
  • The UPN (user principal name) is the sign-in name. Its domain must be one the tenant has verified: the built-in *.onmicrosoft.com one, or a custom domain you proved you own with a DNS TXT record. contoso.example is not ours, so the request fails.
  • --force-change-password-next-sign-in makes the first sign-in ask for a new password. That is the normal way to hand over a new account.
  • az ad talks to Microsoft Graph (graph.microsoft.com), the directory's API, not to Azure Resource Manager. az ad user show returns Graph's default properties only. accountEnabled, usageLocation and userType are not in that default set, so ask Graph for them with $select:
$ az ad user update --id [email protected] --display-name "Maria Ionescu (SRE)"
$ az rest --method get --url "https://graph.microsoft.com/v1.0/users/[email protected]?\$select=displayName,userType,usageLocation" --query "{name:displayName, type:userType, location:usageLocation}"
{
  "location": null,
  "name": "Maria Ionescu (SRE)",
  "type": "Member"
}

az rest sends any request to Graph (or to ARM) with your az login token. Use it for whatever az ad doesn't wrap: licences, invitations, policies. The \$ stops bash from expanding $select as a variable.

Bulk work (the exam calls it "bulk create / invite"): the portal takes a CSV template (Users › Bulk operations), and a script loops az ad user create over a file. Deleting a user moves them to Deleted users for 30 days. You can restore them from there with their group memberships and licences, then they are gone for good.

Licences and the usage location

A licence (Microsoft 365 E3, Entra ID P1, P2...) is bought per tenant as a SKU with a number of seats and assigned to users. Several Entra features depend on licences: dynamic groups, group-based licensing, Conditional Access and SSPR for cloud users all need P1 or better. Privileged Identity Management and risk-based Identity Protection need P2.

$ az rest --method get --url https://graph.microsoft.com/v1.0/subscribedSkus --query "value[].{sku:skuPartNumber, used:consumedUnits, seats:prepaidUnits.enabled, id:skuId}" -o table
Sku             Used  Seats
--------------  ----  -----
AAD_PREMIUM     0     10
AAD_PREMIUM_P2  0     5
SPE_E3          0     3
$ az rest --method post --url https://graph.microsoft.com/v1.0/users/[email protected]/assignLicense --body '{"addLicenses":[{"skuId":"078d2b04-f1bd-4111-bbd4-b4b1b354cef4"}],"removeLicenses":[]}'
ERROR: Bad Request({"error":{"code":"Request_BadRequest","message":"License assignment cannot be done for user with invalid usage location.","innerError":{"date":"2026-09-22T20:00:05","request-id":"eb728025-2cd1-4d03-96f8-ff3f1ccd3957","client-request-id":"8042af29-a416-4f65-a0f5-894c3ce60923"}}})

The usual first error: a licence needs a usage location, the two-letter country where the user will use the services. Some services are not offered in every country, so Microsoft has to know. Set it, then assign:

$ az rest --method patch --url https://graph.microsoft.com/v1.0/users/[email protected] --body '{"usageLocation":"RO"}'
$ az rest --method post --url https://graph.microsoft.com/v1.0/users/[email protected]/assignLicense --body '{"addLicenses":[{"skuId":"078d2b04-f1bd-4111-bbd4-b4b1b354cef4"}],"removeLicenses":[]}' --query userPrincipalName -o tsv
[email protected]
$ az rest --method get --url https://graph.microsoft.com/v1.0/users/[email protected]/licenseDetails --query "value[].skuPartNumber" -o tsv
AAD_PREMIUM

Group-based licensing (P1): assign the licence to a group, and every member gets it, now and later. That is how real tenants do it. Joiners get licensed by joining the group, leavers lose the seat when they leave it. When a seat can't be assigned (no seats left, conflicting plans), the group shows the users "in error". That is the first place to look when someone says "I have no Teams". The portal does group-based licensing (Entra ID › Groups › Licenses). Per-user assignment is what the API above does.

Groups

$ az ad group create --display-name sre-oncall --mail-nickname sre-oncall --query "{name:displayName, security:securityEnabled}"
{
  "name": "sre-oncall",
  "security": true
}
$ az ad group member add --group sre-oncall --member-id $(az ad user show --id [email protected] --query id -o tsv)
$ az ad group member list --group sre-oncall --query "[].userPrincipalName" -o tsv
[email protected]
  • Security groups are for access: RBAC, app access, licences. Microsoft 365 groups add a mailbox, a calendar and a SharePoint site for a team. They can be used for access too.
  • Membership is assigned (someone adds members) or dynamic (a rule on user attributes, e.g. user.department -eq "SRE", evaluated by Entra; needs P1). A dynamic group can't have members added by hand.
  • Owners of a group manage its members without being directory admins. That is how teams look after their own on-call group.

External users (B2B guests)

A contractor from Contoso needs read access to a resource group. Don't create [email protected] with a password you then have to manage. Invite her: she signs in with her own company account, and when she leaves Contoso her access stops by itself.

$ az rest --method post --url https://graph.microsoft.com/v1.0/invitations --body '{"invitedUserEmailAddress":"[email protected]","inviteRedirectUrl":"https://myapps.microsoft.com","sendInvitationMessage":true}' --query "{status:status, user:invitedUser.id}"
{
  "status": "PendingAcceptance",
  "user": "3cd3c05a-5c17-4083-b738-4bc9ae317d98"
}
$ az ad user list --filter "userType eq 'Guest'" --query "[].{upn:userPrincipalName, mail:mail}" -o table
Upn                                                 Mail
--------------------------------------------------  --------------------
dana_contoso.example#EXT#@sysoplab.onmicrosoft.com  [email protected]
  • The guest is a user object in your tenant with userType Guest and a UPN like dana_contoso.example#EXT#@sysoplab.onmicrosoft.com. You give it groups and roles like any user.
  • PendingAcceptance until she opens the invitation link and consents. Then she is Accepted.
  • Who may invite is set in External collaboration settings (Entra ID › External Identities): everyone, members only, or admins and the Guest Inviter role. You can also allow or block invitations to specific domains. Guests by default can't browse the directory the way members can (the guest user role).
  • Review guests regularly (an access review, P2): guests nobody re-approves are the accounts attackers like, because nobody notices them.

Self-service password reset (SSPR)

SSPR lets a user who forgot their password reset it themselves, after proving who they are with the authentication methods they registered: mobile app notification or code, email, mobile phone, office phone, security questions. You choose:

  • Who: None, Selected (one group: pilot with a group first), or All.
  • How many methods are required to reset: 1 or 2.
  • Which methods are allowed, and whether users must register at their next sign-in.
  • Notifications: tell the user when their password was reset, and tell admins when another admin resets theirs.

There is no CLI or v1.0 Graph API for the SSPR policy: it is set in the portal (Entra ID › Password reset). In this lab, Console › Cloud portal › Microsoft Entra ID does it. The Console shows the command it ran:

$ az ad group create --display-name sspr-pilot --mail-nickname sspr-pilot -o none
$ azportal sspr set --enabled Selected --group sspr-pilot --methods 2 --kinds email,mobilePhone,mobileApp
(simulator) portal action: self service password reset: Selected (group sspr-pilot), 2 method(s) required: email, mobilePhone, mobileApp

Facts the exam likes:

  • Cloud users need Microsoft Entra ID P1/P2 (or Microsoft 365 Business Standard / Premium) to reset a forgotten password. Changing a known password is free. Password writeback to on-premises AD (for users synced with Entra Connect) needs P1/P2 or Business Premium.
  • Administrators always have SSPR on, with a stricter policy: two methods, no security questions. The policy you set applies to normal users only.
  • "Selected" takes one group. Roll out to a pilot group, check the registration report, then go to All.

On the exam (AZ-104 1.1.1-1.1.5): create users and groups (portal, bulk CSV, CLI), change their properties, assign licences (usage location first; group-based licensing needs P1), invite external users (B2B guests, External collaboration settings, Guest Inviter) and configure SSPR (scope None/Selected/All, number of methods, registration, notifications). Expect "which licence" and "why did the licence assignment fail" questions.

In an interview: "A new engineer joins. What do you set up in Entra?" - "A member account with a verified-domain UPN and a temporary password they must change, a usage location, then membership of the team's groups: group-based licensing gives the licences and the groups carry the Azure role assignments, so nobody grants access per person. SSPR is on for the group so password resets don't come to us. A contractor gets a B2B guest invite instead of a local account."

What you can now do

  • Create and update users, and read the properties az ad leaves out with az rest and $select.
  • Assign a licence (usage location first) and know which features need P1 and P2.
  • Invite a guest and find guests with --filter "userType eq 'Guest'".
  • Configure SSPR for a pilot group and say what licence it needs.

Why it helps

Every access problem in Azure starts in the directory: who is this account, what groups is it in, does it still exist, is it a guest nobody remembers. Getting joiners, movers, leavers and guests right is where most real security incidents could have been stopped.

On the AZ-104 these are easy points that people lose to details: a licence needs a usage location, SSPR for cloud users needs P1, administrators always have SSPR on, deleted users can be restored for 30 days.

Commands in this lesson

az

FAQ

Why does az ad user show not return accountEnabled or usageLocation?

az ad talks to Microsoft Graph and only asks for Graph's default set of properties. Ask for the others explicitly with az rest and $select, for example ?$select=displayName,userType,usageLocation. The value is not missing, it was simply not requested.

Why did assigning a licence fail?

Usually the user has no usage location: Microsoft needs to know the country to know which services it may offer, so set usageLocation first. The other common reasons are no free seats left in that SKU, or a conflict between service plans in two licences. With group-based licensing the group shows such users as "in error".

Guest account or a local account for a contractor?

A guest. A B2B guest signs in with their own organisation's account, so when they leave that company their access to yours stops too, and you never manage their password. Give the guest roles through a group, and review guests regularly with access reviews.

Does SSPR work for administrators?

Yes, always, and with a stricter policy than the one you configure: two methods are required and security questions are not allowed. The settings in Password reset apply to normal users only, and you can scope them to a pilot group with "Selected".

What happens when I delete a user?

The user moves to Deleted users and can be restored with its group memberships for 30 days, then it is permanently deleted. Role assignments that pointed at the user stay behind as "Identity not found" until someone removes them, so remove them before deleting.

In an interview Mid

A new engineer joins and a contractor starts next week. What do you set up in Entra?

For the engineer: a member account with a verified-domain UPN and a temporary password they must change, a usage location, then membership of the team's groups. Group-based licensing gives the licences and the groups carry the Azure role assignments, so nothing is granted per person. SSPR is on for the group, so password resets don't come to us. The contractor gets a B2B guest invite (az rest to the invitations endpoint, or the portal) and a group with just the role they need, reviewed regularly.

Also asked: What is the difference between a security group and a Microsoft 365 group? · What licence does self-service password reset need for cloud users? · How do you find all guest users in a tenant?

Practise this lesson in the terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.