Identity Best Practices: Security Hardening

The practices that keep your Azure identity secure โ€” least privilege, reviews, MFA, and proper delegation
๐ŸŸก Intermediate โฑ 15 Minutes ๐Ÿ“˜ AZ-104 ยท Module 01
Why This Matters

Bad identity practices are how breaches happen. Weak passwords, unused accounts, overly permissive roles, missing audit trails โ€” these are the exploits hackers use. This doc covers the practices that keep your Azure identity secure: least privilege, regular reviews, MFA, and proper delegation.

Before You Start

PrerequisitesEntra ID Overview, RBAC Fundamentals, Access Control Scenarios
Time to understand15 minutes
Difficulty๐ŸŸก Intermediate (security mindset helpful)
What you'll learnHow to secure identity and access in Azure

Best Practice 1: Least Privilege Access

The Principle

Least Privilege = Give people only the minimum access they need, nothing more.

Wrong (Excessive Access)

Employee: "I need to deploy code" Manager: "Okay, I'll give you Owner role on the subscription" Result: Employee can delete EVERYTHING, including databases โœ—

Right (Least Privilege)

Employee: "I need to deploy code" Manager: "Okay, I'll give you Container Registry Contributor (push images only)" Result: Employee can only push to registry, can't delete other resources โœ“

Implementation

Step 1: Determine minimum needed "What is the smallest role that lets them do their job?" Step 2: Start with Reader If you don't know, start with read-only, expand only if needed Step 3: Remove over time At end of project: "Do you still need Contributor?" โ†’ Remove if not โœ“ Step 4: Review quarterly Question every role: "Is this still necessary?"

Roles Ranked by Privilege (Most to Least)

1. Owner (everything, delete RGs) โ””โ”€ Give to: IT directors, cloud architects only 2. Contributor (create/modify, NOT delete RGs) โ””โ”€ Give to: Senior engineers, ops teams 3. Operator roles (specific operations like "start VMs") โ””โ”€ Give to: Support staff, automation accounts 4. Reader (read-only, no changes) โ””โ”€ Give to: Auditors, consultants, everyone else by default 5. Custom roles (exact permissions needed) โ””โ”€ Use when no built-in role fits

Best Practice 2: Regular Access Reviews

The Problem

Access Creep (Permissions grow over time):

Year 1: Employee hired โ†’ assigned Contributor role Year 2: Moves to different project โ†’ keeps old Contributor role Year 3: Gets promoted โ†’ gets new role, doesn't lose old ones Year 4: Employee leaves โ†’ access not revoked for 6 months Result: Former employee still has access โœ—

Implementation

Quarterly Access Review Checklist: โ”œโ”€ Question 1: "Are they still in the role's group?" โ”œโ”€ Question 2: "Does the job still require this role?" โ”œโ”€ Question 3: "When was this role last used?" โ”œโ”€ Question 4: "Has their responsibility changed?" โ””โ”€ Question 5: "Any unusual activity from this account?" For YES answers โ†’ Keep For NO answers โ†’ Remove (audit the removal)

Azure Policy to Help

Policy: "Inactive accounts get read-only access after 90 days" Logic: โ”œโ”€ If no sign-in in 90 days โ”œโ”€ Remove Contributor role โ”œโ”€ Keep Reader role (if absolutely needed) โ””โ”€ Send email asking "Can we disable this account?" Result: โ”œโ”€ Inactive accounts can't cause damage โ”œโ”€ Budget impact reduced โ””โ”€ Security surface shrinks

Best Practice 3: Enable Multi-Factor Authentication (MFA)

The Problem

Weak Passwords Get Hacked:

Attacker gets password: P@ssw0rd123 โ”œโ”€ Without MFA: Logs in immediately โœ— โ”œโ”€ With MFA: Can't log in (no phone/app) โœ“

Implementation

Option 1: Require for Admin Roles Only

โ””โ”€ Conditional Access Policy โ””โ”€ If role is Global Admin โ†’ Require MFA โ””โ”€ Balance: Moderate security + usability

Option 2: Require for All Users

โ””โ”€ All users must register MFA method โ””โ”€ Highest security, impacts user experience

Option 3: Risk-Based (Conditional Access)

โ””โ”€ Require MFA if: โ”œโ”€ Sign-in from unusual location โœ“ โ”œโ”€ Sign-in from unfamiliar device โœ“ โ”œโ”€ Multiple failed login attempts โœ“ โ””โ”€ Normal sign-in from known location โ†’ No MFA needed โœ“ โ””โ”€ Best balance of security + usability

MFA Methods (Order by Security)

1. Windows Hello / Biometric โ””โ”€ Most secure, works only on configured device 2. Microsoft Authenticator app โ””โ”€ Very secure, phone required 3. FIDO2 security key โ””โ”€ High security, requires special hardware 4. SMS/Text message โ””โ”€ Least secure (vulnerable to sim-jacking) โ””โ”€ Better than nothing, but don't use alone
Recommendation

Require Authenticator app or Windows Hello for admins.

Best Practice 4: Monitor Sign-in Activity

The Problem

Suspicious Activity = Breach in Progress:

Attacker steals password โ”œโ”€ Signs in from China (your company is in US) โ”œโ”€ Accesses data โ”œโ”€ Deletes resources โ””โ”€ You don't notice for weeks โœ—

Implementation

Entra ID โ†’ Monitoring โ†’ Sign-in logs What to Look For: โ”œโ”€ Sign-in from unusual country โ”œโ”€ Sign-in from unknown device โ”œโ”€ Multiple failed sign-in attempts (password guessing) โ”œโ”€ Sign-in outside business hours โ”œโ”€ Bulk changes (deleting users, roles) by one person โ””โ”€ Access to sensitive data by unusual users

Set Up Alerts

Alert 1: Failed sign-in attempts

โ”œโ”€ If > 5 failed attempts in 5 minutes โ”œโ”€ Email IT immediately โ””โ”€ Lock account for 15 minutes (Entra feature)

Alert 2: Sign-in from unusual location

โ”œโ”€ If user signed in from new country โ”œโ”€ Require MFA re-verification โ””โ”€ Send notification to user

Alert 3: Unusual resource access

โ”œโ”€ If deleted users / roles changed by unusual person โ”œโ”€ Flag for immediate investigation โ””โ”€ Require approval for such operations

Best Practice 5: Use Groups, Not Individual Assignments

The Problem

Individual Assignments Don't Scale:

Assign role to 50 individuals โ”œโ”€ "sara@company.com" โ†’ Contributor โ”œโ”€ "mike@company.com" โ†’ Contributor โ”œโ”€ ... (48 more times) โ”œโ”€ Someone leaves โ†’ Did you remove all 12 of their roles? โ””โ”€ New person joins โ†’ Did you add them to all required roles? โœ—

Implementation

Use groups instead: โ”œโ”€ Create grp-engineering-contributors โ”œโ”€ Add 50 people to the group โ”œโ”€ Assign Contributor to the GROUP (once) โ”œโ”€ Someone leaves โ†’ remove from group, they lose all roles โœ“ โ”œโ”€ New person โ†’ add to group, they get all roles โœ“ Policy: "All role assignments must be to groups, not individuals" โ””โ”€ Exception: Service principals can have individual roles โ””โ”€ Result: All human access is via groups, trackable, scalable

Best Practice 6: Separate Duty / Approval Required

The Problem

One Person Can Approve Themselves:

Alice wants Contributor role on Production โ”œโ”€ Alice submits request โ”œโ”€ Alice's manager approves (she IS the manager!) โ”œโ”€ Alice approves her own request โ””โ”€ No one else reviews โ†’ potential security risk โœ—

Implementation: Approval Chain

โ”œโ”€ Request: Employee submits (I need role X on resource Y) โ”œโ”€ Approval 1: Manager (does this make sense for their job?) โ”œโ”€ Approval 2: Security team (is the resource sensitive?) โ”œโ”€ Approval 3: Resource owner (do you want this person?) โ””โ”€ Execution: IT provisions role only after all approvals โœ“ Exception: Same person cannot approve their own request

Azure Entitlement Management

Azure AD โ†’ Identity Governance โ†’ Entitlement Management Setup: โ”œโ”€ Create access package (e.g., "Production-Contributor") โ”œโ”€ Define who can request (all employees) โ”œโ”€ Define approval workflow (manager + security) โ”œโ”€ Set expiration (roles auto-expire after 90 days) โ””โ”€ Auto-review (request approval before expiration) Benefit: โ”œโ”€ Formal audit trail โœ“ โ”œโ”€ Proper separation of duty โœ“ โ”œโ”€ Auto-cleanup (no orphaned roles) โœ“ โ””โ”€ Full compliance evidence โœ“

Best Practice 7: Disable Unused Accounts Quickly

The Problem

Orphaned Accounts = Security Risk:

Employee leaves on Friday โ”œโ”€ Managers forget to disable account โ”œโ”€ Account still active Monday โ”œโ”€ Credentials stolen/sold on dark web Tuesday โ”œโ”€ Attacker has access Wednesday (nobody notices yet) โ””โ”€ Breach discovered 6 months later โœ—

Implementation

Offboarding Process

โ”œโ”€ Step 1: Day of departure โ†’ Disable account in Entra ID โ”œโ”€ Step 2: Revoke all role assignments โ”œโ”€ Step 3: Remove from all groups โ”œโ”€ Step 4: If not needed in 30 days โ†’ Delete account โ”œโ”€ Step 5: Audit: Search for old accounts, disable any orphaned ones

Automation & Verification

Automation: โ”œโ”€ HR system โ†’ Email IT when employee terminates โ”œโ”€ IT runs script to: โ”‚ โ”œโ”€ Disable account โ”‚ โ”œโ”€ Remove from groups โ”‚ โ””โ”€ Send notification โ””โ”€ Manager confirms cleanup complete Verification: โ””โ”€ Quarterly: Check for disabled accounts >90 days old, delete them

Best Practice 8: Use Service Principals with Passwords Only When Necessary

The Problem

Service Principals with Passwords = Shared Secrets:

App uses hardcoded password โ”œโ”€ Password stored in code (bad!) โ”œโ”€ Password stored in config files (bad!) โ”œโ”€ Password rotated slowly/never (bad!) โ”œโ”€ Password exposure = app compromise โœ—

Implementation

Bad: Service principal with password app โ†’ connects to Azure โ†’ authenticates with password โ””โ”€ Password shared everywhere Good: Service principal with certificate app โ†’ connects to Azure โ†’ authenticates with certificate โ””โ”€ Certificate renewed automatically, harder to steal Best: Managed Identity app โ†’ runs on Azure โ†’ auto-authenticated (no credentials needed!) โ””โ”€ Azure manages all credential rotation internally โœ“

When Each Applies

Managed Identity (PREFERRED)

โ””โ”€ Use when: App runs on Azure VM, App Service, Container, Function โ””โ”€ Benefit: Zero secrets to manage โœ“

Service Principal + Certificate

โ””โ”€ Use when: App runs outside Azure, certificate can be renewed โ””โ”€ Benefit: More secure than passwords

Service Principal + Password (AVOID)

โ””โ”€ Use only if: Certificate isn't possible (rare) โ””โ”€ Caveat: Must rotate password every 90 days minimum

Best Practice Checklist

โ˜ Implement Least Privilege

โ””โ”€ Audit: Are your lowest roles even lower than they need to be?

โ˜ Quarterly Access Reviews

โ””โ”€ Schedule: First Monday of each quarter โ””โ”€ Owner: IT security team

โ˜ Require MFA for Admins

โ””โ”€ Minimum: All roles with "Admin" in the name โ””โ”€ Better: Risk-based MFA for all users

โ˜ Monitor Sign-in Logs

โ””โ”€ Tool: Entra Sign-in logs โ””โ”€ Alert: Unusual geography, failed attempts, bulk changes

โ˜ Use Groups Exclusively

โ””โ”€ Audit: Do any role assignments exist to individual users? โ””โ”€ Policy: Enforce group-based assignments

โ˜ Require Approval for Sensitive Roles

โ””โ”€ Setup: Entitlement Management with approval workflow โ””โ”€ Sensitive roles: Owner, User Administrator, Global Admin

โ˜ Offboard Quickly

โ””โ”€ SLA: Disable account within 24 hours of departure โ””โ”€ Verify: Monthly audit of disabled accounts

โ˜ Use Managed Identities

โ””โ”€ Apps on Azure โ†’ Managed Identity โ””โ”€ Apps off Azure โ†’ Certificate or (rarely) password

How This Connects to Other Topics

Related to All Modules

  • Every Azure operation goes through identity
  • Policies enforce best practices (MFA, encryption, etc.)
  • Audit logs prove compliance

Related Labs

See It In Action

Related labs:

Key Takeaways

๐Ÿ’ก Summary
  • Least privilege = minimal access needed, nothing more
  • Regular reviews = catch permission creep before it becomes a breach
  • MFA = makes password theft much less valuable
  • Groups = easier to manage than individual assignments
  • Audit logs = prove who did what, when, for compliance
  • Approval workflows = prevent unilateral access grants
  • Quick offboarding = disable accounts before they become liabilities
  • Managed identities = best-practice app authentication on Azure

Next Steps

  1. Review: Read this doc (you're here)
  2. Implement: Start with MFA and quarterly reviews
  3. Monitor: Set up sign-in alerts
  4. Audit: Migrate individual assignments to groups