Skip to content

Intermediate · Identity and network defence · topic 16 of 43 · 35 min

Identity and access management, least privilege and RBAC

Explanation

Identity and access management (IAM) decides who someone is and what they may do. The key rule is least privilege: give each person only the access their job needs, for only as long as they need it. Role-based access control (RBAC) makes this manageable by giving permissions to roles, and roles to people.

Why identity is the new perimeter

Years ago, companies protected a "castle" network with a firewall around it. Today staff work from home, apps live in the cloud and partners log in from outside. The thing that decides whether someone gets in is their identity: their account and what it is allowed to do. Many breaches start with a stolen account, not a broken firewall.

Four steps: identify, authenticate, authorise, account

StepQuestionExample
IdentificationWho do you claim to be?Typing your username or employee ID
AuthenticationCan you prove it?Password plus authenticator app code
AuthorisationWhat may you do?You can view payslips but not edit salaries
Accounting (auditing)What did you do?A log entry: "ravi exported 300 records at 18:02"

People often mix up authentication (proving identity) and authorisation (permissions). A useful memory trick: authentication is the gate guard checking your ID card; authorisation is which floors your card opens.

Least privilege

Least privilege means every person, program and service account gets the minimum access needed to do its job, and no more. If an account is stolen or misused, the damage is limited to what that account could do.

  • A support agent can view orders but not issue refunds over ₹5,000.
  • A backup program can read files but not delete them.
  • An intern gets read-only access to the test database, not production.
  • Admin rights are given just-in-time for a task and removed after (sometimes called privileged access management, PAM).

Role-based access control (RBAC)

Giving permissions person by person becomes a mess in a company of 500. RBAC groups permissions into roles that match jobs, like "cashier", "branch manager" or "auditor". People are given roles; roles carry permissions. When someone changes job, you change their role, and their permissions follow.

python
ROLES = {
    "cashier": {"view_account", "deposit", "withdraw"},
    "manager": {"view_account", "deposit", "withdraw", "approve_loan"},
    "auditor": {"view_account", "view_logs"},
}
USERS = {"asha": ["cashier"], "vikram": ["manager"], "neha": ["auditor"]}

def can(user, action):
    return any(action in ROLES[role] for role in USERS.get(user, []))

print(can("asha", "withdraw"), can("asha", "approve_loan"), can("neha", "view_logs"))
A tiny RBAC check. Shows True False True.

Other models exist. Attribute-based access control (ABAC) uses attributes such as department, location or time of day ("finance staff, from office network, on working days"). Many real systems combine RBAC with a few ABAC rules.

The joiner, mover, leaver process

  • Joiner: a new employee gets accounts and roles on day one, approved by their manager.
  • Mover: someone changes team; old access is removed when new access is added. If not, they collect more and more access over the years (privilege creep).
  • Leaver: all access is disabled on the last day. Ex-employees with live accounts are a classic incident.

Regular access reviews, for example every quarter, ask managers to confirm that each person still needs each access.

Single sign-on and federation

Single sign-on (SSO) lets people log in once to an identity provider (such as Microsoft Entra ID, Okta or Google Workspace) and then use many apps. Standards like SAML and OpenID Connect carry the proof of login to each app. SSO means one place to enforce MFA and one switch to turn off a leaver.

Common mistakes

  • Shared accounts ("finance@company" used by six people). Nobody is accountable. Give each person an account.
  • Service accounts with domain admin rights and passwords that never change.
  • Granting "temporary" admin access and never removing it.
  • Checking permissions only in the app's menus, not on the server.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Identity and access management, least privilege and RBAC · 1/7

Identity = the new perimeter

Identity is the new perimeter. Many breaches start with a stolen account.

Prefer a video by a teacher? Find free videos on “identity and access management least privilege RBAC explained” on YouTube ↗

In real life: The leaver who still had access

A sales executive left a Mumbai distribution company to join a competitor. His CRM account was not disabled because HR's exit list did not reach IT. For three weeks he kept logging in from home and exported the customer list. The company then linked HR's exit system to the identity provider so that accounts are disabled automatically on the last working day, and started quarterly access reviews.

Practice (0/3 done)

Task 1 · Question

A bank clerk can log in (her password is correct) but gets "access denied" when opening the loan approval screen. Which step stopped her?

Task 2 · Code · Python

Complete can(user, action). USERS maps a user to a list of role names; ROLES maps a role to a set of actions. Return True if ANY of the user's roles allows the action. Unknown users get False.

Task 3 · Code · Python

Access review. active is a set of usernames with live accounts; hr_staff is a set of current employees. Write orphan_accounts(active, hr_staff, service) that returns a sorted list of active accounts that are neither current employees nor in the set service (approved service accounts).

Quick quiz

Question 1

1.What is least privilege?

Question 2

2.In RBAC, permissions are attached to…

Question 3

3.An employee moved from finance to marketing two years ago and still has finance access. This is…

Question 4

4.Why are shared accounts a problem?

Question 5

5.Which is a benefit of single sign-on?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

What is least privilege?

Answer: Each account gets only the access its job needs

Minimum access limits damage when an account is misused.

In RBAC, permissions are attached to…

Answer: Roles

Roles carry permissions; people are given roles.

An employee moved from finance to marketing two years ago and still has finance access. This is…

Answer: Privilege creep

Access piling up across job changes is privilege creep.

Why are shared accounts a problem?

Answer: Nobody can tell which person did what

Accounting fails: actions cannot be tied to a person.

Which is a benefit of single sign-on?

Answer: One place to enforce MFA and disable a leaver

Central identity makes control and offboarding much easier.

Which IAM identity gives temporary credentials and is the right choice for a Lambda function?Related

Answer: IAM role

Lambda runs with an execution role; AWS supplies temporary credentials.

From IAM: users, groups, roles and least privilege

Developers may create their own IAM roles, but never more powerful than a set limit. What enforces that limit?Related

Answer: A permissions boundary

A permissions boundary caps the permissions of the users or roles it is set on.

From Identity is the new perimeter

Why are roles with temporary credentials better than access keys for apps?Related

Answer: Credentials expire automatically, so a leak is useful for a short time only

Short-lived credentials shrink the window of misuse.

From Cloud identity and access management

What is the difference between Entra roles and Azure roles?Related

Answer: Entra roles manage the directory (users, apps); Azure roles manage Azure resources

Global Administrator is an Entra role; Owner and Contributor are Azure roles. They are separate systems.

From Microsoft Entra ID and Azure RBAC

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 3 more topics in “Identity and network defence” before its exam: Firewalls, Intrusion detection and prevention (IDS/IPS), Network segmentation, zero trust and VPNs.
  2. Module 4 exam: Identity and network defence · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Logs, SIEM and incident response. 43 topics left in the course before the final exam.

← Previous: Certificates and PKI