← All articlesSecurity

Microsoft Defender for Endpoint Onboarding

Ishfaq Nazir · Microsoft & Azure Cloud Security Architect 3/26/2026 8 min read

Microsoft Defender for Endpoint Onboarding

Introduction

In today's complex threat landscape, endpoint security is no longer an optional extra but a foundational pillar of a robust cybersecurity strategy. Organizations face a continuous barrage of sophisticated attacks, ranging from phishing and malware to advanced persistent threats (APTs). Microsoft Defender for Endpoint (MDE) offers a comprehensive, cloud-powered endpoint detection and response (EDR) solution that helps prevent, detect, investigate, and respond to advanced threats.

This article provides a detailed guide on onboarding devices to Microsoft Defender for Endpoint. It is intended for IT professionals, security administrators, and cloud engineers responsible for securing their organization's endpoints within the Microsoft ecosystem. Whether you are deploying MDE for the first time or expanding its coverage, this guide will walk you through the essential concepts, implementation steps, and best practices to ensure a successful onboarding process.

Why this matters

The effective onboarding of devices to MDE is critical for several compelling reasons, impacting security posture, operational efficiency, and regulatory compliance. From a security perspective, an unmanaged or inadequately protected endpoint represents a significant vulnerability, a potential entry point for attackers that can compromise an entire network. MDE's EDR capabilities provide visibility into endpoint activities, enabling rapid detection and automated response to emerging threats, thereby significantly reducing the mean time to detect (MTTD) and mean time to respond (MTTR) to incidents.

Beyond security, MDE contributes to operational savings by consolidating multiple security tools into a single platform, simplifying management and reducing licensing costs. Proactive threat hunting and automated remediation free up valuable security analyst time, allowing them to focus on higher-level strategic initiatives. Furthermore, maintaining a strong security posture with MDE helps organizations meet stringent compliance requirements, such as GDPR, HIPAA, and PCI DSS, by demonstrating effective controls over endpoint data and access, thus mitigating regulatory risks and potential penalties.

Key concepts

  • Microsoft Defender for Endpoint (MDE): A comprehensive, cloud-powered endpoint security platform that includes capabilities such as threat and vulnerability management, attack surface reduction, next-generation protection, endpoint detection and response (EDR), automated investigation and remediation, and Microsoft Threat Experts.
  • Tenant (MDE Instance): Your organization's specific instance of Microsoft Defender for Endpoint, accessible through the Microsoft 365 Defender portal. This is where all your security data, configurations, and responses are managed.
  • Onboarding Method: The specific process used to enroll devices into MDE. Common methods include Microsoft Intune, Group Policy, Microsoft Endpoint Configuration Manager (MECM), local script, VDI onboarding, and API-driven onboarding.
  • Onboarding Package: A device-specific or tenant-specific script/package generated from the Microsoft 365 Defender portal that contains the necessary configuration and agent to onboard devices.
  • Sensor: The MDE agent built into Windows 10/11 and Windows Server 2012 R2+ (with the unified agent) that collects behavioral data, detects threats, and communicates with the MDE cloud service.
  • Group Policy Object (GPO): A collection of settings that define how computers and users behave in an Active Directory environment. Used for large-scale, domain-joined device onboarding.
  • MDM (Mobile Device Management) Solution: Such as Microsoft Intune, used to deploy configuration profiles and scripts to managed endpoints, including MDE onboarding scripts.
  • Service Principal: An identity created for applications, hosted services, and automated tools to access Azure resources, often used for API-driven onboarding or automation.

Step-by-step implementation

The onboarding process typically involves configuring your MDE tenant, obtaining the appropriate onboarding package, and then deploying that package to your endpoints using a suitable management tool. We'll use Intune for a modern, cloud-first approach.

  1. Verify Licensing: Ensure your organization has the necessary licenses for Microsoft Defender for Endpoint (e.g., Microsoft 365 E5, Enterprise Mobility + Security E5, Defender for Endpoint Standalone).
  2. Access Microsoft 365 Defender Portal: Navigate to security.microsoft.com and sign in with an account that has Global Administrator, Security Administrator, or Defender for Endpoint Administrator permissions.
  3. Enable Core Features:

Go to Settings > Endpoints > Advanced features. Enable features like "Automated investigation," "Live response," "Tamper protection," and "Unified auditing." These features are crucial for MDE's full capabilities.

  1. Configure Data Storage Location: If prompted, select your data storage location. This decision cannot be changed later.
  2. Generate Onboarding Package (Intune Script):

In the Microsoft 365 Defender portal, go to Settings > Endpoints > Onboarding. Select the operating system for the devices you want to onboard (e.g., "Windows 10 and 11"). Choose "Microsoft Intune" as your deployment method. Download the onboarding package (WindowsDefenderATPOnboardingPackage.zip). This typically contains a .intunewin file or a script. (For Windows Server 2012 R2/2016, you would download a different script and relevant prerequisite files).

  1. Deploy Onboarding Package via Microsoft Intune:

Navigate to the Microsoft Intune admin center ([endpoint.microsoft.com](https://endpoint.microsoft.com/)). Go to Devices > Configuration profiles > Create profile. Select Platform: "Windows 10 and later", Profile type: "Templates", Template name: "Endpoint detection and response". Configure the profile. Under "Endpoint detection and response (Defender for Endpoint)", set "Endpoint detection and response (Defender for Endpoint) clients" to "Not configured" if you are using the onboarding package script. Alternatively, and more commonly for onboarding, you create a custom script deployment: Go to Devices > Scripts > Add > Windows 10 and later. Name the script (e.g., "MDE Onboarding Script"). Upload the onboarding script (e.g., MDE_Onboarding_Script.cmd or similar from the downloaded package). Configure script settings (e.g., "Run script as 64-bit PowerShell" to "No", "Run this script using the logged on credentials" to "No"). Assign the script to the appropriate device groups that contain the endpoints you wish to onboard.

# Example: Deploying the MDE Onboarding script to Intune using PowerShell and Microsoft.Graph module
# This assumes you have already downloaded the WindowsDefenderATPOnboardingPackage.zip
# and extracted the MDE onboarding script (e.g., WindowsDefenderATPOnboardingScript.cmd or .ps1)
# and converted it to a base64 encoded string if needed for direct script upload.

# Install-Module Microsoft.Graph -Force # Uncomment if Module not installed
# Connect-MsolService # If using MSOL for older cmdlets
Connect-MgGraph -Scopes "DeviceManagementManagedDevices.ReadWrite.All","DeviceManagementApps.ReadWrite.All" # Connect to Microsoft Graph

# Path to your MDE onboarding script
$scriptPath = "C:\Temp\WindowsDefenderATPOnboardingScript.cmd" # Or .ps1
$scriptContent = [System.IO.File]::ReadAllText($scriptPath)
$base64ScriptContent = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($scriptContent))

# Define the script details for Intune
$displayName = "Microsoft Defender for Endpoint Onboarding Script"
$description = "Automated onboarding script for Windows devices to MDE"
$fileName = Split-Path -Leaf $scriptPath
$runAsAccount = "System" # Or User if it requires user context
$runAfter = "Never" # Or set a schedule if needed
$assignment = @{
    "@odata.type" = "#microsoft.graph.deviceManagementScriptAssignment"
    target = @{
        "@odata.type" = "#microsoft.graph.groupAssignmentTarget"
        groupId = "<Your_Target_Intune_Device_Group_ID>" # Replace with the Azure AD Group ID for device assignment
    }
}

# Create the Intune Device Management Script
$scriptPayload = @{
    displayName = $displayName
    description = $description
    scriptContent = $base64ScriptContent
    fileName = $fileName
    runAsAccount = $runAsAccount
    # publisher = "Zunair Tech" # Optional
    # version = "1.0" # Optional
    # scriptLanguage = "powershell" # Or "batch" if it's a .cmd/.bat file
    # runAs32Bit = $false # If it's a 64-bit system script
}

# For cmd/batch files, you might need to adjust content type and script type
# For .cmd/.bat:
# $scriptPayload.scriptLanguage = "batch"
# $scriptPayload.scriptContent = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($scriptContent)) # Use ASCII for CMD

# Example of creating the script (adjust based on actual script type)
# For PowerShell script:
$scriptPayload.scriptLanguage = "powershell"
$createdScript = New-MgDeviceManagementDeviceShellScript -Body $scriptPayload

# For Batch script:
# $scriptPayload.scriptLanguage = "batch"
# $createdScript = New-MgDeviceManagementDeviceManagementScript -Body $scriptPayload -Path "/deviceManagement/deviceManagementScripts"
# (Note: The Graph API for batch scripts might require a different endpoint or payload structure)

Write-Host "Intune script created with ID: $($createdScript.id)"

# Assign the script to a group
# New-MgDeviceManagementDeviceShellScriptAssignment -DeviceShellScriptId $createdScript.id -Body $assignment
# The above command might not work directly without proper nested object structure.
# A simpler way is often to do this manually in Intune portal after script creation,
# or to ensure the '$assignment' variable is correctly formatted for the Graph API call.

# It's often easier to create the script via Graph and then assign it manually in the Intune Portal to ensure proper group targeting.
# Alternatively, query existing assignments and recreate/update.
# Manual assignment in Intune: Devices -> Scripts -> [Your Script] -> Assignments.
  1. Monitor Onboarding Status: In the Microsoft 365 Defender portal, go to Assets > Devices to monitor the onboarding status of your endpoints. It may take some time for devices to appear after the script has run.

Example configuration

This JSON snippet demonstrates a configuration profile for Endpoint Detection and Response in Intune, setting the onboarding package for MDE. This is an alternative to deploying a raw script, leveraging Intune's built-in MDE connector.

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/deviceConfigurations/$entity",
  "id": "e2ba77a8-3561-4c12-9c3f-c603b53c14c5",
  "lastModifiedDateTime": "2023-10-27T09:30:00Z",
  "createdDateTime": "2023-10-27T09:25:00Z",
  "description": "Configures Windows 10/11 devices for Microsoft Defender for Endpoint onboarding via Intune's EDR policy.",
  "displayName": "MDE Onboarding Configuration Profile",
  "version": 1,
  "@odata.type": "#microsoft.graph.windows10EndpointProtectionConfiguration",
  "microsoftDefenderForEndpointOnboardingPackage": "UEsDBBQAAAAIAIdtqVoPZ9K5bAEAABoTAAAIAAAAV2luZG93c0RlZmVuZGVyQVRQT25ib2FyZGluZ1BhY2thZ2Uuc2NlbmFyaW9UEsHAnkUAAAsAAAMAACUBAAAkPCEtLSBkZWZhdWx0IEFjY291bnQgRXhwaXJhdGlvbiBkYXRlIGlzIDYwIGRheXMgb3IgMTEvMjUvMjAyM... (truncated base64 encoded onboarding package)",
  "endpointCloudBlockLevel": "high",
  "networkProtection": "enable",
  "attackSurfaceReductionOnlyMode": "block",
  "firewallBlockAllIncomingTraffic": false,
  "dataProtection": null,
  "antimalwareEngine": {
    "realtimeProtection": "enable",
    "scanProcesses": "scanAll",
    "scanArchives": "notConfigured",
    "scanRemovableDrives": "disabled",
    "scanNetworkDrives": "disabled",
    "checkForSignaturesBeforeRunningScan": "disabled",
    "signatureUpdateInterval": 0,
    "cloudDelivery": "enable",
    "disableCatchupScan": false,
    "disableArchiveScanning": false,
    "disableBehaviorMonitoring": false,
    "disableIOAVProtection": false,
    "disableIntrusionPreventionSystem": false,
    "disablePrivateNetworkScanning": false,
    "disableRnaProtection": false,
    "disableScriptScanning": false,
    "disableSpynetReports": false,
    "disableGenericReports": false,
    "disableAutoSampleSubmission": false
  },
  "windowsDefenderExploitProtection": null,
  "defenderExploitProtectionNewerWindows": null
}

Common pitfalls

  • Licensing Gaps: Attempting to onboard devices without the correct Defender for Endpoint licenses, leading to agent deployment failures or lack of functionality reported in the console.
  • Unsupported Operating Systems: Not ensuring that the target operating systems are supported by MDE, or using an outdated onboarding package for unsupported versions (e.g., Windows Server 2012 R2 without the unified agent update).
  • Network Connectivity Issues: Endpoints failing to communicate with the MDE cloud service due to firewall restrictions, proxy configurations, or insufficient internet access, preventing data transmission and policy enforcement.
  • Conflicting Security Software: Existing antivirus or other endpoint security solutions interfering with the MDE agent installation or operation, leading to performance issues or incomplete protection.
  • Improper Group Assignment: Deploying the onboarding script or configuration profile to an incorrect or overly broad group of devices, missing critical endpoints or generating unexpected results.
  • Tamper Protection Not Configured: Failing to enable tamper protection, leaving the MDE agent vulnerable to malicious actors attempting to disable its services.

Best practices

  • Phased Rollout: Implement MDE onboarding in phases, starting with a pilot group of devices, then expanding to departmental groups, and finally to the entire organization. This allows for identification and resolution of issues before a broad impact. Align this with the Cloud Adoption Framework's "Adopt" phase for security.
  • Leverage Intune for Modern Management: For Windows 10/11 devices, prioritize onboarding via Microsoft Intune. This provides a unified management plane, simplifies deployment, and integrates seamlessly with other Microsoft 365 security features, adhering to Zero Trust principles by securing access from any device.
  • Automate with Device Groups: Use dynamic Azure AD device groups to automatically include or exclude devices from MDE onboarding policies based on attributes. This reduces manual overhead and ensures consistent application of security configuration.
  • Enable Tamper Protection Globally: Configure tamper protection policies via Intune or Defender for Endpoint settings as a core protection mechanism against sophisticated attacks attempting to disable or manipulate MDE. This aligns with the Well-Architected Framework's security pillar for resilience.
  • Integrate with SIEM/SOAR: Integrate MDE alerts and events into your Security Information and Event Management (SIEM) or Security Orchestration, Automation, and Response (SOAR) solutions (e.g., Microsoft Sentinel) for centralized monitoring, advanced analytics, and automated incident response workflows.
  • Regularly Review Onboarding Status and Alerts: Continuously monitor the MDE portal for device health, onboarding status, and security alerts. Proactively address devices that fail to onboard or report issues to maintain comprehensive coverage.

Further reading

#MDE#EDR

Related articles