Compliance / Remediation ยท Modern Endpoint Guides
โœ… Microsoft Intune

Compliance Policies & Proactive Remediation

From defining compliance requirements per platform and configuring non-compliance actions, to Custom Compliance JSON scripts and Proactive Remediations for auto-fixing common device issues before they trigger alerts.

๐Ÿ“… Updated: May 2026 โฑ๏ธ Setup time: 3โ€“6 hours ๐ŸŽฏ Audience: Intune Admins, Security Engineers ๐Ÿ“‹ License: Intune P1 / P2

๐Ÿ“‹ Compliance Overview & Lifecycle

Intune compliance policies define the rules a device must meet to be considered compliant. The compliance state is fed into Conditional Access โ€” non-compliant devices can be blocked from accessing corporate resources.

๐Ÿ”„ Compliance States

  • Compliant โ†’ All settings met โ†’ full access
  • Non-Compliant โ†’ At least one setting failed
  • In Grace Period โ†’ Not compliant but within deadline
  • Not Evaluated โ†’ Policy not yet applied
  • Unknown โ†’ Device not checked in recently

โฑ๏ธ Compliance Lifecycle

1

Policy Created & Assigned

Policy targets a device group. Device receives policy on next check-in.

2

Device Evaluates Settings

Device checks local settings against policy rules and reports to Intune.

3

Non-Compliance Actions Triggered

If not compliant: send email, mark non-compliant, add to retirement schedule.

4

CA Blocks Access

If CA policy requires compliant device, access to M365 is blocked for non-compliant device.

๐ŸชŸ Windows Compliance Settings

๐Ÿ”’ Recommended Windows Compliance Settings

SettingRecommended ValueRisk if Not Set
Minimum OS version10.0.22000 (Win 11) or 10.0.19044 (Win 10 21H2)Old OS with known vulnerabilities
BitLocker requiredRequiredData exposure on lost/stolen device
Secure Boot enabledRequiredBoot-time malware risk
Code integrityRequiredUnsigned driver loading
Antivirus (Windows Defender)RequiredNo malware protection
Antivirus signatures up-to-dateRequiredKnown malware not detected
FirewallRequiredNetwork attack exposure
MDE Device Risk ScoreMedium or belowCompromised device accessing corp data
Password requiredRequired (6+ chars, complexity)Unauthorized physical access

๐Ÿ“ฑ iOS & Android Compliance

๐Ÿ“ฑ iOS Compliance Settings

SettingRecommended
Minimum iOS version17.0 (or latest - 1)
Passcode requiredRequired
Minimum passcode length6 characters
Jailbroken devicesBlock (Non-Compliant)
MDE threat levelSecured or Low
Maximum minutes of inactivity before lock5 minutes

๐Ÿค– Android (Enterprise) Compliance

SettingRecommended
Minimum Android version13.0
Rooted devicesBlock
Device encryptionRequired
Google Play ProtectRequired
Threat scan on appsRequired
MDE threat levelSecured or Low
PIN requiredRequired (6+ digits)

๐ŸŽ macOS Compliance

๐Ÿ’ป macOS Compliance Settings

SettingRecommended
Minimum macOS version14.0 (Sonoma)
FileVault disk encryptionRequired
Firewall enabledRequired
System Integrity Protection (SIP)Required
GatekeeperRequired (Mac App Store and identified developers)
Password requiredRequired
MDE threat levelSecured or Low

๐Ÿ› ๏ธ Custom Compliance (JSON + PowerShell)

Custom Compliance allows you to define any compliance requirement not available in the built-in settings โ€” using a PowerShell detection script that outputs JSON, and a JSON rule file that Intune evaluates against.
# Detection Script (PowerShell โ€“ runs on device)
# Returns JSON with key-value pairs for Intune to evaluate

$result = @{}

# Check if specific software version is installed
$app = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" |
    Where-Object { $_.DisplayName -like "*CorporateSecurity*" }
$result["CorporateSecurityInstalled"] = [bool]$app
$result["CorporateSecurityVersion"] = if ($app) { $app.DisplayVersion } else { "0.0.0" }

# Check custom registry setting
$regVal = Get-ItemPropertyValue "HKLM:\SOFTWARE\Contoso\Security" -Name "HardeningLevel" -ErrorAction SilentlyContinue
$result["HardeningLevel"] = $regVal ?? 0

# Output JSON (required format)
return $result | ConvertTo-Json -Compress
// Compliance Rule JSON (uploaded to Intune)
{
  "Rules": [
    {
      "SettingName": "CorporateSecurityInstalled",
      "Operator": "IsEquals",
      "DataType": "Boolean",
      "Operand": true,
      "MoreInfoUrl": "https://contoso.com/security/agent",
      "RemediationStrings": [
        {
          "Language": "en_US",
          "Title": "Corporate Security Agent Missing",
          "Description": "Install the Corporate Security Agent from the Software Center."
        }
      ]
    },
    {
      "SettingName": "HardeningLevel",
      "Operator": "GreaterEquals",
      "DataType": "Int64",
      "Operand": 2,
      "RemediationStrings": [
        {
          "Language": "en_US",
          "Title": "Hardening Level Too Low",
          "Description": "Run the Hardening script from Software Center to achieve Level 2."
        }
      ]
    }
  ]
}

โšก Non-Compliance Actions

๐Ÿ“‹ Available Actions (in order)

ActionWhen to Use
Mark device non-compliantDay 0 โ€” immediately block CA
Send email to end userDay 1 โ€” notify with remediation steps
Send push notificationDay 1 โ€” Company Portal push alert
Send email to additional usersDay 3 โ€” notify manager/helpdesk
Remotely lock deviceDay 7 โ€” enforce device lock
Retire deviceDay 30 โ€” remove corporate data

๐Ÿ“ง Email Template Tips

  • Use a custom email template with company branding
  • Include clear remediation steps (numbered)
  • Include helpdesk contact info
  • Link to a self-service remediation guide
  • Available template variables: {{DeviceName}}, {{UserName}}, {{ComplianceStatus}}

โณ Grace Period

โฐ Grace Period Settings

  • Configure per policy or per action
  • Device shows "In Grace Period" state โ€” CA still allows access
  • Typical: 3โ€“7 days for standard settings
  • 0 days = immediately non-compliant (use for critical settings)
  • Grace period starts from when non-compliance is first detected

๐ŸŽฏ Grace Period Strategy

  • Security-critical settings (BitLocker, AV): 0โ€“1 day grace
  • OS version: 7โ€“14 days (allow time to update)
  • Password policy: 3 days
  • New policy rollout: 30 days for first month

๐Ÿ” Conditional Access Integration

The compliance state from Intune is automatically fed to Entra ID Conditional Access. No manual sync needed โ€” when a device becomes compliant, the CA token is updated within minutes.

๐Ÿ”— How Compliance โ†’ CA Works

Compliance StateCA "Require compliant device" Result
Compliantโœ… Access granted
In Grace Periodโœ… Access granted (until grace expires)
Non-CompliantโŒ Blocked โ€” must remediate
Not Evaluated / UnknownโŒ Blocked (no policy = no compliance claim)

๐Ÿค– Proactive Remediations

Proactive Remediations (Endpoint Analytics) run PowerShell scripts on devices on a schedule. A detection script identifies an issue; if detected, a remediation script automatically fixes it โ€” before the user even notices.

๐Ÿ” Detection Script Logic

  • Exit code 0 = No issue detected (healthy)
  • Exit code 1 = Issue detected (trigger remediation)
  • Can also output string messages for reporting
  • Runs in 32-bit or 64-bit PowerShell, as SYSTEM or user

๐Ÿ› ๏ธ Remediation Script Logic

  • Runs only if detection exits with code 1
  • Exit code 0 = Remediation successful
  • Exit code 1 = Remediation failed
  • Should fix the issue found by detection script
  • Runs as SYSTEM โ€” elevated by default

๐Ÿ“… Common Proactive Remediation Scenarios

ScenarioDetectionRemediation
Time zone incorrectCheck if TZ = corp standardSet-TimeZone to correct zone
Windows Update service stoppedCheck wuauserv service stateStart-Service wuauserv; Set-Service auto
Stale DNS cache causing issuesAlways true (scheduled task)Clear-DnsClientCache
Old temp files consuming diskCheck C:\Windows\Temp sizeRemove old temp files
OneDrive sync stuckCheck OneDrive sync statusRestart OneDrive process
Expired WiFi certificateCheck cert expiry dateRemove and re-request cert via SCEP

๐Ÿ’ป Proactive Remediation Script Examples

# DETECTION: Check if Windows Update service is running
$service = Get-Service -Name wuauserv -ErrorAction SilentlyContinue
if ($service.Status -eq "Running") {
    Write-Output "Windows Update service is running"
    exit 0  # Healthy
} else {
    Write-Output "Windows Update service is NOT running"
    exit 1  # Issue detected โ€“ trigger remediation
}

# REMEDIATION: Start Windows Update service and set to automatic
try {
    Set-Service -Name wuauserv -StartupType Automatic
    Start-Service -Name wuauserv
    Write-Output "Windows Update service started successfully"
    exit 0  # Remediation successful
} catch {
    Write-Output "Failed to start Windows Update service: $($_.Exception.Message)"
    exit 1  # Remediation failed
}

###################################################
# DETECTION: Check if device timezone is correct
$expectedTZ = "Israel Standard Time"
$currentTZ = (Get-TimeZone).Id
if ($currentTZ -eq $expectedTZ) {
    exit 0
} else {
    Write-Output "Timezone mismatch: $currentTZ"
    exit 1
}

# REMEDIATION: Set correct timezone
Set-TimeZone -Id "Israel Standard Time"
exit 0

๐Ÿ“Š Reports & Monitoring

๐Ÿ“‹ Compliance Dashboard

  • Intune โ†’ Reports โ†’ Device compliance
  • % compliant per platform
  • Non-compliant device list
  • Setting-level compliance drill-down

๐Ÿค– Remediation Reports

  • Intune โ†’ Reports โ†’ Endpoint analytics
  • Detection rate per script
  • Remediation success/failure count
  • Export to CSV

๐Ÿ“ˆ Non-Compliance Trend

  • Historical compliance rate over time
  • Top non-compliant settings
  • Devices stuck in grace period
  • Export and integrate with SIEM

๐Ÿ”ง Troubleshooting

โŒ Common Issues & Fixes

IssueCauseFix
Device stuck in "Not Evaluated"Policy not reached device; stale enrollmentForce Intune sync; re-enroll if needed
BitLocker compliance fails even when encryptedBitLocker not using correct protector typeVerify TPM protector in use: manage-bde -status
MDE risk level wrongMDE not fully onboarded; risk not updatedVerify SENSE service running; check MDE onboarding
Remediation script failsScript error or runs in wrong contextTest script manually as SYSTEM; check output in Intune
Compliance email not sentMail connector not configuredVerify email notification settings in Intune tenant
Custom compliance script errorJSON format incorrect or missing fieldsValidate JSON format; check Intune-required schema

โœ… Implementation Checklist

๐Ÿ“‹ Compliance Policies

  • Windows compliance policy (BitLocker, AV, OS version)
  • iOS compliance policy (jailbreak, min OS)
  • Android compliance policy (root, encryption, Play Protect)
  • macOS compliance policy (FileVault, SIP, Gatekeeper)
  • MDE risk level integrated into compliance
  • Grace periods set appropriately per setting type

โšก Non-Compliance Actions

  • Day 0: Mark non-compliant configured
  • Day 1: Email notification to user configured
  • Email template customized with remediation steps
  • Day 7: Remote lock for mobile devices
  • CA policy requiring compliant device enabled

๐Ÿค– Proactive Remediations

  • Windows Update service check/fix remediation
  • Time zone correction remediation
  • Disk space cleanup remediation
  • Schedules set appropriately (daily/weekly)
  • Remediation reports monitored weekly

๐Ÿ“Š Reporting

  • Compliance dashboard reviewed weekly
  • Non-compliant device list actioned
  • Custom compliance policies for org-specific requirements
  • Integration with SIEM for compliance alerts