IAM & Identity Security

Authentication Hardening & Conditional Access

4 min read

With stolen credentials causing 36% of cloud incidents, strong authentication is your first line of defense. MFA adoption has reached 53% in enterprises (2024), but implementation quality varies significantly.

Multi-Factor Authentication (MFA)

MFA Types and Strength

TypeSecurity LevelUse Case
Hardware security key (FIDO2)HighestRoot accounts, admins
Hardware TOTP tokenHighRegulated environments
Authenticator app (TOTP)MediumGeneral users
SMS/Email codesLow (avoid)Legacy only, being phased out
Push notificationMediumConvenience balance

AWS MFA Configuration

Root account (mandatory):

# Hardware MFA for root is critical - CIS Benchmark 1.5
aws iam create-virtual-mfa-device --virtual-mfa-device-name root-mfa

# Enable for root user
aws iam enable-mfa-device \
    --user-name root \
    --serial-number arn:aws:iam::123456789012:mfa/root-mfa \
    --authentication-code-1 123456 \
    --authentication-code-2 654321

IAM users with policy enforcement:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyAllExceptListedIfNoMFA",
      "Effect": "Deny",
      "NotAction": [
        "iam:CreateVirtualMFADevice",
        "iam:EnableMFADevice",
        "iam:GetUser",
        "iam:ListMFADevices",
        "iam:ListVirtualMFADevices",
        "iam:ResyncMFADevice",
        "sts:GetSessionToken"
      ],
      "Resource": "*",
      "Condition": {
        "BoolIfExists": {
          "aws:MultiFactorAuthPresent": "false"
        }
      }
    }
  ]
}

Azure Conditional Access

Azure provides sophisticated access control beyond simple MFA:

Basic MFA policy:

{
  "displayName": "Require MFA for All Users",
  "state": "enabled",
  "conditions": {
    "users": {
      "includeUsers": ["All"]
    },
    "applications": {
      "includeApplications": ["All"]
    }
  },
  "grantControls": {
    "operator": "OR",
    "builtInControls": ["mfa"]
  }
}

Risk-based conditional access:

{
  "displayName": "Block High Risk Sign-ins",
  "state": "enabled",
  "conditions": {
    "users": {
      "includeUsers": ["All"]
    },
    "signInRiskLevels": ["high", "medium"]
  },
  "grantControls": {
    "operator": "OR",
    "builtInControls": ["block"]
  }
}

Location-based restrictions:

{
  "displayName": "Admin Access from Named Locations Only",
  "conditions": {
    "users": {
      "includeRoles": [
        "62e90394-69f5-4237-9190-012177145e10"
      ]
    },
    "locations": {
      "includeLocations": ["All"],
      "excludeLocations": ["TrustedOfficeLocations"]
    }
  },
  "grantControls": {
    "builtInControls": ["block"]
  }
}

GCP Context-Aware Access

# Access level requiring device compliance
accessLevels:
  - name: "accessPolicies/123/accessLevels/corporate_devices"
    basic:
      conditions:
        - devicePolicy:
            requireCorpOwned: true
            osConstraints:
              - osType: DESKTOP_CHROME_OS
                minimumVersion: "100"
        - ipSubnetworks:
            - "10.0.0.0/8"

Session Security

Session Duration Limits

ProviderDefaultRecommended
AWS IAM12 hours1-4 hours for admins
AzureConfigurable1 hour for sensitive ops
GCP12 hoursShort sessions, frequent re-auth

AWS: Limit role session duration:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::123456789012:user/dev"},
    "Action": "sts:AssumeRole",
    "Condition": {
      "NumericLessThan": {
        "sts:MaxSessionDuration": "3600"
      }
    }
  }]
}

Just-in-Time (JIT) Access

Azure Privileged Identity Management (PIM):

  • Users request elevated access
  • Approval workflow triggers
  • Access granted for limited time
  • Full audit trail
# Activate PIM role (Azure CLI)
az rest --method POST \
    --uri "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleRequests" \
    --body '{
        "principalId": "user-guid",
        "roleDefinitionId": "admin-role-guid",
        "directoryScopeId": "/",
        "action": "SelfActivate",
        "scheduleInfo": {
            "expiration": {
                "type": "afterDuration",
                "duration": "PT4H"
            }
        }
    }'

Zero Trust Implementation

The Zero Trust model: "Never trust, always verify."

Core Principles

PrincipleImplementation
Verify explicitlyMFA, device compliance, location
Least privilegeJust-in-time, just-enough access
Assume breachMicro-segmentation, monitoring

Zero Trust Architecture

┌─────────────────────────────────────────────────────────┐
│                    Access Decision                       │
├─────────────────────────────────────────────────────────┤
│  User Identity → Device Health → Location → Context     │
│       ↓              ↓             ↓          ↓         │
│  Strong Auth    Compliance     Geofence   Time/Risk    │
│       ↓              ↓             ↓          ↓         │
│  ──────────────── Policy Engine ────────────────       │
│                        ↓                                │
│              Allow / Deny / Step-up Auth                │
└─────────────────────────────────────────────────────────┘

Authentication Audit Checklist

ControlStatusPriority
Root/admin accounts have hardware MFACritical
All users require MFAHigh
Conditional access policies deployedHigh
Session timeouts configuredMedium
Impossible travel detection enabledMedium
JIT access for privileged rolesMedium
Device compliance requiredMedium
Legacy authentication blockedHigh

Next module: We'll secure cloud storage services—the most common source of data exposure. :::

Quick check: how does this lesson land for you?

Quiz

Module 2: IAM & Identity Security

Take Quiz
FREE WEEKLY NEWSLETTER

Stay on the Nerd Track

One email per week — courses, deep dives, tools, and AI experiments.

No spam. Unsubscribe anytime.