# (L1) Ensure devices without a compliance policy are marked 'not compliant'

4.1 (L1) Ensure devices without a compliance policy are marked 'not compliant'

Source: https://maester.dev/docs/tests/CIS.M365.4.1

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/oed-metzb" title="Benjamin Metz · Original author"><img src="https://github.com/oed-metzb.png" alt="Benjamin Metz" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/mynster9361" title="-Mynster · Co-contributor"><img src="https://github.com/Mynster9361.png" alt="-Mynster" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/korthal-maiyn" title="Christopher Edwards · Co-contributor"><img src="https://github.com/Korthal-Maiyn.png" alt="Christopher Edwards" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/oed-metzb">Benjamin Metz</a> with 2 co-contributors</span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/cis">CIS</a> · Intune · Device compliance · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId CIS.M365.4.1
```

## Overview

4.1 (L1) Ensure devices without a compliance policy are marked 'not compliant'

Compliance policies are sets of rules and conditions that are used to evaluate the configuration of managed devices. These policies can help secure organizational data and resources from devices that don't meet those configuration requirements. Managed devices must satisfy the conditions you set in your policies to be considered compliant by Intune. When combined with Conditional Access, this allows more control over how non-compliant devices are treated.

The recommended state is **Mark devices with no compliance policy assigned as** **Not compliant**

This test runs the same check as [MT.1054](https://maester.dev/docs/tests/MT.1054). The benchmark's audit reads the Intune device management settings and verifies that `secureByDefault` is `true`, which is what MT.1054 checks. The default, **Compliant** (`secureByDefault` is `false`), fails.

#### Rationale

Implementing this setting is a first step in adopting compliance policies for devices. When used in together with Conditional Access policies the attack surface can be reduced by forcing an action to be taken for non-compliant devices.

>Note: This section does not focus on which compliance policies to use, only that an organization should adopt and enforce them to their needs.

#### Impact

Any devices without a compliance policy will be marked not compliant. Care should be taken to first deploy any new compliance policies with a Conditional Access (CA) policy that is in the Report-only state. After the environment's device compliance is better understood it is then appropriate to finally align with **Mark devices with no compliance policy assigned as** and enable any CA policies that enforce actions based on device compliance.

If a mature environment already has an existing device compliance CA policy and a large number of devices without an assigned compliance policy, this could cause disruption as those devices would then be suddenly considered not compliant.

#### Remediation action

1. Navigate to [Microsoft Intune admin center](https://intune.microsoft.com).
2. Click on **Devices** and then under **Managed devices** on **Compliance**.
3. Click **Compliance settings**.
4. Ensure **Mark devices with no compliance policy assigned as** set to **Not compliant**

##### PowerShell

1. Connect to Microsoft Graph using `Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All"`
2. Run the following commands:

```powershell
$Uri = 'https://graph.microsoft.com/v1.0/deviceManagement'
$Body = @{
    settings = @{
        secureByDefault = $true
    }
} | ConvertTo-Json
Invoke-MgGraphRequest -Uri $Uri -Method PATCH -Body $Body
```

#### Related links

* [Microsoft Intune admin center](https://intune.microsoft.com)
* [Use compliance policies to set rules for devices you manage with Intune](https://learn.microsoft.com/intune/intune-service/protect/device-compliance-get-started)
* [CIS Microsoft 365 Foundations Benchmark v7.0.0 - Page 184](https://www.cisecurity.org/benchmark/microsoft_365)

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | CIS.M365.4.1 |
| Severity | Medium |
| Suite | CIS |
| Product | Intune |
| Feature | Device compliance |
| Area | Devices and endpoints |
| Resource type | Tenant |
| User impact | Medium |
| Implementation cost | Medium |
| MITRE ATT&CK | T1078.004 Cloud Accounts |
| Supports benchmark | CIS Microsoft 365 Foundations Benchmark (version 7.0.0), requirement 4.1 |
| Benchmark level | L1 |
| Benchmark profiles | E3 Level 1, E5 Level 1 |
| Supports controls | cis-m365:4.1, nist-800-53-r5:AC-19, nist-800-53-r5:CM-6 |
| PowerShell test | [Test-MtCisDevicesWithoutCompliancePolicyMarked](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.4.1.ps1) |
| Services | Graph |
| Compatible licenses | INTUNE_A |

</details>

## Source

- Test: [`tests/cis/Test.CIS.M365.4.1.ps1`](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.4.1.ps1)
- Documentation: [`tests/cis/Test.CIS.M365.4.1.md`](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.4.1.md)
