← Back to articles Intune

Microsoft Tunnel VPN for MAM on Unenrolled Android Devices

Microsoft Tunnel VPN for MAM on Unenrolled Android Devices

Most enterprise environments have a population of devices that will never fully enroll in MDM — contractor laptops running Android, BYOD phones where users refuse enrollment, or partner devices where your org has no management rights. Microsoft Tunnel for MAM closes that gap by extending the Tunnel VPN Gateway to unenrolled Android devices using App Protection Policies and App Configuration Policies, with Microsoft Defender for Endpoint acting as the VPN client. This article walks through the complete implementation from architecture to production-hardened configuration.

Licensing GateThis feature requires Microsoft Intune Plan 2 or the Microsoft 365 E5/F5 Security add-on. Standard Intune P1 is insufficient. Verify licensing before you spend time on infrastructure.

The Full Architecture

MICROSOFT TUNNEL FOR MAM — TRAFFIC ARCHITECTUREUNENROLLED DEVICEDefender (VPN)Microsoft EdgeCompany PortalLOB App (MAM SDK)Tunnel GatewayLinux ServerDocker / PodmanOn-Prem / CorpInternal ResourcesINTUNE ADMIN CENTER — POLICY PLANEDefender App ConfigEdge App ConfigApp ProtectionAll 3 policies musttarget SAME Entra group
Unenrolled Android device connects through Microsoft Defender VPN client → Tunnel Gateway Linux server → corporate resources. Three Intune policies (Defender App Config, Edge App Config, App Protection) must all target the same Entra ID group and work in concert.

MDM vs MAM Tunnel — Know the Boundary

Before touching a single policy, understand the mutual exclusivity rules. Enrolled devices can receive either an MDM Tunnel configuration or a MAM Tunnel configuration — but not both simultaneously. That combination produces silent conflicts that are genuinely difficult to diagnose.

VALID vs INVALID CONFIGURATION COMBINATIONS✓ Enrolled + MDMDevice-level VPN profile✓ Enrolled + MAMApp-level tunnel config✗ Enrolled + BOTHConflict — DO NOT USE✓ Unenrolled + MAMPrimary use case (this guide)StrictTunnelMode behavior also differs: Edge app config (MAM) vs device-level VPN profile (MDM)⚠ StrictTunnelMode in Edge app config only applies to unenrolled devices — it is silently ignored on enrolled devices
Four valid/invalid configuration states. The bottom warning is a real-world trap: StrictTunnelMode in the Edge app config does nothing on enrolled devices — you need the device-level tunnel VPN profile for that.

Prerequisites Checklist

Infrastructure FirstYou must have an existing, working Microsoft Tunnel Gateway (Linux server, Docker or Podman, at least one configured Site) before any of this works. MAM support is an extension of the existing Tunnel infrastructure — it does not replace or bypass it.
ComponentRequirementCritical?
Intune Plan 2 or M365 E5/F5 SecurityLicense — check before anything
Tunnel Gateway + Site configuredExisting infra required
Microsoft Defender for Endpoint (Android)Min version 1.0.4722.0101
Intune MAM SDK (Android)Min version 9.5.0 for Trusted Root cert support
Microsoft Edge (Android)Latest from Google Play
Intune Company Portal (Android)Any current version — must remain installed, sign-in NOT required
Android version10+ for Proxy config; 11+ for MAMCertTrustWebViewClient
Azure 21VianetNot supported
FIPSNot supported
GCC High / DoDSupported
Company Portal Silent DependencyUsers will uninstall Company Portal because it appears to do nothing on an unenrolled device. It must stay installed. The MAM framework depends on it being present even though the user never signs into it. Build user comms around this before you deploy.

Implementation: Three Policies, One Group

The entire MAM Tunnel configuration is delivered through exactly three Intune policies. All three must target the identical Entra ID group. A mismatch in group targeting is the single most common cause of MAM Tunnel failures in production.

  1. App Configuration Policy — Microsoft Defender for Endpoint

    Navigate to Intune Admin Center → Apps → App configuration policies → Create → Managed Apps. Set target to Managed Apps (unenrolled), select Microsoft Defender Endpoint for Android as the public app.

    Configure the Microsoft Tunnel settings block:

    // Key settings in Defender App Config policy
    "Use Microsoft Tunnel VPN": "Yes"
    "Connection name": "Corp-MAM-Tunnel"   // User-visible name
    "Site Name": "[Select existing Tunnel Site]"
    "Per-App VPN (Android)": "Optional"
    "Always-on VPN": "No"  // CRITICAL: keep this disabled
    Never Enable Always-on VPN HereEnabling Always-on VPN in the Defender App Config policy causes persistent connection failures and generates notification spam on user devices. Use StrictTunnelMode in the Edge policy instead.
    One Policy Per Device RuleDeploy exactly ONE Defender App Config policy per unenrolled device. If multiple policies with different tunnel settings land on the same device, they will conflict silently. Audit your group assignments carefully.
  2. App Configuration Policy — Microsoft Edge

    Create a second App Config policy: target Managed Apps (unenrolled), public app Microsoft Edge for Android. Add the following General Configuration key/value pairs:

    // Edge App Config — General Configuration Settings
    
    Key: "com.microsoft.intune.mam.managedbrowser.StrictTunnelMode"
    Value: "True"
    // Blocks all internet traffic in Edge when VPN is disconnected
    // Only applies to unenrolled (MAM) devices — ignored on enrolled devices
    
    Key: "com.microsoft.intune.mam.managedbrowser.TunnelAvailable.IntuneMAMOnly"
    Value: "True"
    // Enables identity-switch: VPN auto-connects on Work account,
    // auto-disconnects on personal account or InPrivate browsing
    Trailing Spaces Break Everything SilentlyIf you have a trailing space after True in either value field, the keys will not work and you will get no error. Strip trailing whitespace. Always. This has burned more than one production deployment.
  3. App Protection Policy — Microsoft Edge

    Navigate to Intune Admin Center → Apps → App protection policies → Create → Android. Target Microsoft Edge (Public App).

    On the Data Protection tab, scroll to the bottom and set:

    "Start Microsoft Tunnel connection on app-launch": "Yes"

    Assign to the same Entra ID group as both App Config policies above.

    Group Alignment = Everything WorkingAll three policies — Defender App Config, Edge App Config, App Protection — must target the identical Entra group. This is not optional. The MAM framework requires all three to be co-present on the device.

Identity Switch Behavior in Edge

The TunnelAvailable.IntuneMAMOnly key enables context-aware VPN connectivity. Understanding this state machine prevents a lot of confused user tickets.

EDGE IDENTITY SWITCH — VPN STATE MACHINEWork AccountVPN CONNECTEDPersonal AccountVPN DISCONNECTEDInPrivate BrowseVPN DISCONNECTEDWork ResumesVPN RECONNECTSswitch to privateswitch back to work
Edge automatically connects or disconnects the Tunnel VPN based on which account context is active. Personal browsing and InPrivate mode never get VPN — only the work identity does. This is by design, not a bug.

LOB App Integration with MAM SDK

If you have internal Line of Business apps that need to traverse the Tunnel, they must integrate the Intune MAM SDK at version 9.5.0 or higher. The SDK exposes two certificate trust APIs you will need if your internal resources use private PKI certificates.

API ClassCoversMin Android
MAMTrustedRootCertsManagerSSLContext, SSLSocketFactory, TrustManager, WebViewAndroid 10+
MAMCertTrustWebViewClientWebView-specific certificate trustAndroid 11+

LOB apps must be deployed as Available (not Required) from Intune to unenrolled devices. Deploying as Required to unenrolled devices will fail silently.

Supported Certificate FormatsTrusted root certificates must be DER encoded binary X.509 or PEM format. Configure the trusted cert profile in your App Config policy under Microsoft Tunnel for MAM Settings → Root Certificate.

Automating Policy Deployment via Graph API

Once you understand the manual configuration, you should codify it. Here is the Graph API call to create a Managed App configuration policy for the Defender tunnel settings:

// POST — Create Defender App Config Policy for MAM Tunnel
POST https://graph.microsoft.com/beta/deviceAppManagement/targetedManagedAppConfigurations

// Request Body
{
  "displayName": "MAM-Tunnel-Defender-Config",
  "description": "Defender VPN config for unenrolled Android MAM Tunnel",
  "platformId": "android",
  "customSettings": [
    {
      "name": "VPN",
      "value": "true"
    }
  ],
  "apps": [
    {
      "mobileAppIdentifier": {
        "@odata.type": "#microsoft.graph.androidMobileAppIdentifier",
        "packageId": "com.microsoft.scmx"  // Defender package ID
      }
    }
  ]
}
// GET — Retrieve existing MAM App Config Policies to audit
GET https://graph.microsoft.com/beta/deviceAppManagement/targetedManagedAppConfigurations

// Filter by display name
GET https://graph.microsoft.com/beta/deviceAppManagement/targetedManagedAppConfigurations?$filter=displayName eq 'MAM-Tunnel-Defender-Config'

PowerShell: Audit MAM Tunnel Policy Alignment

This script connects to Microsoft Graph and audits whether all three required MAM Tunnel policies exist and are assigned to the same Entra group. Run it after any policy change to confirm alignment.

# MAM Tunnel Policy Alignment Auditor
# Requires: Microsoft.Graph PowerShell SDK
# Scopes: DeviceManagementApps.Read.All, Group.Read.All

param(
    [string]$TargetGroupName = "MAM-Tunnel-Users"
)

Connect-MgGraph -Scopes "DeviceManagementApps.Read.All", "Group.Read.All"

# Resolve target group ID
$group = Get-MgGroup -Filter "displayName eq '$TargetGroupName'"
if (-not $group) {
    Write-Error "Group '$TargetGroupName' not found. Exiting."
    exit 1
}
Write-Host "Target Group: $($group.DisplayName) [$($group.Id)]" -ForegroundColor Cyan

# Fetch all MAM app config policies
$appConfigs = Invoke-MgGraphRequest -Method GET `
    -Uri "https://graph.microsoft.com/beta/deviceAppManagement/targetedManagedAppConfigurations"

$defenderPolicy = $appConfigs.value | Where-Object { $_.apps.mobileAppIdentifier.packageId -contains "com.microsoft.scmx" }
$edgeConfigPolicy = $appConfigs.value | Where-Object { $_.apps.mobileAppIdentifier.packageId -contains "com.microsoft.emmx" }

# Fetch App Protection Policies
$appProtection = Invoke-MgGraphRequest -Method GET `
    -Uri "https://graph.microsoft.com/beta/deviceAppManagement/androidManagedAppProtections"
$edgeProtPolicy = $appProtection.value | Where-Object { $_.apps.mobileAppIdentifier.packageId -contains "com.microsoft.emmx" }

# Helper: check if a policy targets our group
function Test-PolicyTargetsGroup {
    param($PolicyId, $GroupId, $PolicyType)
    $assignments = Invoke-MgGraphRequest -Method GET `
        -Uri "https://graph.microsoft.com/beta/deviceAppManagement/${PolicyType}/${PolicyId}/assignments"
    $matched = $assignments.value | Where-Object {
        $_.target.groupId -eq $GroupId
    }
    return ($null -ne $matched)
}

# Audit results
$results = @(
    [PSCustomObject]@{ Policy="Defender App Config"; Found=($null -ne $defenderPolicy); TargetsGroup=($defenderPolicy ? (Test-PolicyTargetsGroup $defenderPolicy.id $group.Id "targetedManagedAppConfigurations") : $false) }
    [PSCustomObject]@{ Policy="Edge App Config";     Found=($null -ne $edgeConfigPolicy); TargetsGroup=($edgeConfigPolicy ? (Test-PolicyTargetsGroup $edgeConfigPolicy.id $group.Id "targetedManagedAppConfigurations") : $false) }
    [PSCustomObject]@{ Policy="Edge App Protection"; Found=($null -ne $edgeProtPolicy); TargetsGroup=($edgeProtPolicy ? (Test-PolicyTargetsGroup $edgeProtPolicy.id $group.Id "androidManagedAppProtections") : $false) }
)

$results | Format-Table -AutoSize

$allGood = $results | Where-Object { -not $_.Found -or -not $_.TargetsGroup }
if ($allGood) {
    Write-Warning "One or more policies missing or not targeting '$TargetGroupName'. Review output above."
} else {
    Write-Host "All three MAM Tunnel policies confirmed targeting '$TargetGroupName'." -ForegroundColor Green
}

Production Gotchas Reference

#IssueRoot CauseFix
1VPN fails + user notificationsAlways-on VPN enabled in Defender configDisable it; use StrictTunnelMode in Edge instead
2Tunnel never connects on launchApp Protection Policy targets different groupAlign all three policies to identical Entra group
3Multiple Defender policies conflictingMore than one App Config policy per deviceEnforce exactly one Defender App Config policy per device
4Proxy config ignoredAndroid version < 10VpnService.Builder limitation — unsupported pre-Android 10
5Trusted certs not working in LOB appsMAM SDK < 9.5.0Upgrade to 9.5.0+ and implement MAMTrustedRootCertsManager
6StrictTunnelMode not blocking on enrolled devicesPolicy applies only to MAM (unenrolled)Use device-level Tunnel VPN profile for enrolled devices
7LOB app deploy failsDeployed as Required to unenrolled deviceChange to Available deployment type
8Edge identity switch brokenTrailing whitespace in config valuesStrip all trailing spaces from key values
9MAM framework stops workingUser uninstalled Company PortalCompany Portal must stay installed — even without sign-in
10Azure 21Vianet / FIPS deploymentNot supported at allNo workaround — these environments are explicitly excluded
Validation SequenceAfter deploying all three policies: (1) confirm Company Portal is installed on test device, (2) open Edge and sign in with a work account, (3) verify Defender shows an active VPN connection, (4) switch to a personal account in Edge and confirm VPN drops. That sequence validates the full stack end-to-end.
Key Docs ReferencesTunnel prerequisites: /intune/protect/microsoft-tunnel-prerequisites — Licensing: /intune/fundamentals/licenses — Trusted cert profiles: /intune/protect/certificates-trusted-root

Was this article helpful?

🎓 Ready to go deeper?

Practice real MD-102 exam questions, get AI feedback on your weak areas, and fast-track your Intune certification.

Start Free Practice → Book a Session
Souhaiel Morhag
Souhaiel Morhag
Microsoft Endpoint & Modern Workplace Engineer

Souhaiel Morhag is a Microsoft Intune and endpoint management specialist with hands-on experience deploying and securing enterprise environments across Microsoft 365. He founded MSEndpoint.com to share practical, real-world guides for IT admins navigating Microsoft technologies — and built the MSEndpoint Academy at app.msendpoint.com/academy, a dedicated learning platform for professionals preparing for the MD-102 (Microsoft 365 Endpoint Administrator) certification. Through in-depth articles and AI-powered practice exams, Souhaiel helps IT teams move faster and certify with confidence.

Related Articles

Popular on MSEndpoint