Technical Reference / Microsoft Intune
Microsoft Intune
Deploy the device agent with Microsoft Intune: deliver the identity file first, then create the agent app, add the installer for each platform, verify enrollment, and start the Windows tray UI at sign-in.
This guide walks an Intune rollout of the device agent from start to finish: deliver the identity file that enrolls each device without an interactive login, create the agent app, add the installer for each platform, verify enrollment, and start the Windows tray UI at sign-in. Shared concepts (the configuration schema, delivery channels, and coverage states) are on the MDM installations page.
Set up the identity file before the agent app. The daemon reads the identity file only when it starts, so an agent that installs first starts unenrolled and stays that way until it restarts.
Step 1: Set up the identity file
Section titled “Step 1: Set up the identity file”Every platform uses the same schema, but the update mode depends on the platform and update owner. Use automatic on macOS. On Windows, use notify for Intune-controlled updates or automatic for agent-controlled updates:
{ "v": 1, "email": "jane.doe@example.com", "org_token": "spk_org_…", "org_slug": "example-corp", "auto_update": "AUTO_UPDATE_MODE"}The file must be readable by the logged-in user, and the daemon only reads it at startup, so restart the daemon after any change.
Windows
Section titled “Windows”Package the script below as its own Win32 app. In Step 3 it is attached to the agent app as a dependency, so Intune installs it first on every device.
1. Set the org token, update owner, and configuration revision. Save the following as Deploy-SpeakeasyManagedJson.ps1, replace REPLACE_WITH_ORG_TOKEN with the organization token from Organization Settings → Secure → Device Agent, and replace AUTO_UPDATE_MODE with notify for Intune-controlled updates or automatic for agent-controlled updates. Set CONFIG_REVISION to a unique value and change it whenever the token or configuration changes. Leave {{mail}} in place; the script substitutes it at install time. Use the form below to fill in the revision, organization details, and update mode, then copy the script. Replace REPLACE_WITH_ORG_TOKEN in your local file before packaging it. Without JavaScript, expand the manual template below and edit its placeholders.
# Writes the Speakeasy device agent identity file (managed.json) for the
# device's enrolled user. Runs as SYSTEM from an Intune Win32 app.
$ErrorActionPreference = 'Stop'
# Change this whenever the token or any value below changes. It names the
# marker file that the app's detection rule checks for.
$configRevision = 'CONFIG_REVISION'
# Intune does not expand {{mail}} inside scripts; this script fills it in.
$template = @'
{
"v": 1,
"email": "{{mail}}",
"org_token": "REPLACE_WITH_ORG_TOKEN",
"org_slug": "example-corp",
"org_name": "Example Corp",
"auto_update": "notify"
}
'@
$dir = Join-Path $env:ProgramData 'Speakeasy'
$file = Join-Path $dir 'managed.json'
$daemon = Join-Path $env:ProgramFiles 'Speakeasy\speakeasyd.exe'
function Get-EnrolledUserEmail {
# The UPN recorded at Intune enrollment. Readable as SYSTEM, even before
# anyone has signed in.
foreach ($key in Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Enrollments' -ErrorAction SilentlyContinue) {
$upn = (Get-ItemProperty $key.PSPath -ErrorAction SilentlyContinue).UPN
if ($upn -like '*@*') { return $upn }
}
# Fallback: the signed-in user's cached Entra identity.
$user = (Get-CimInstance Win32_ComputerSystem).UserName
if ($user) {
$sid = ([System.Security.Principal.NTAccount]$user).Translate([System.Security.Principal.SecurityIdentifier]).Value
$cache = "HKLM:\SOFTWARE\Microsoft\IdentityStore\Cache\$sid\IdentityCache\$sid"
$name = (Get-ItemProperty $cache -ErrorAction SilentlyContinue).UserName
if ($name -like '*@*') { return $name }
}
throw 'Could not determine the enrolled user''s email.'
}
# Stop before touching the device if a placeholder was left in.
$config = $template | ConvertFrom-Json
if ($config.org_token -like 'REPLACE_*') { throw 'Set org_token before packaging this script.' }
if ($config.auto_update -notin 'notify', 'automatic') { throw 'Set auto_update to "notify" or "automatic".' }
$json = $template.Replace('{{mail}}', (Get-EnrolledUserEmail))
# Write UTF-8 without a BOM. A BOM breaks strict JSON parsers.
New-Item -ItemType Directory -Path $dir -Force | Out-Null
[System.IO.File]::WriteAllText($file, $json, [System.Text.UTF8Encoding]::new($false))
# SYSTEM and Administrators get full control, Users get read-only access.
# SIDs keep this working on any OS language. Inheritance is cut so the
# ProgramData default that lets users create files does not apply.
icacls $dir /inheritance:r /grant '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-32-545:(OI)(CI)RX' | Out-Null
icacls $file /inheritance:r /grant '*S-1-5-18:F' '*S-1-5-32-544:F' '*S-1-5-32-545:R' | Out-Null
# The daemon reads managed.json only at startup. On a first rollout the agent
# is not installed yet and reads the file when it first starts. On a later
# revision, restart it so the new values apply.
if (Test-Path $daemon) {
& $daemon -service restart
if ($LASTEXITCODE -ne 0) { throw "speakeasyd restart failed with exit code $LASTEXITCODE." }
}
# Replace any earlier revision marker last, once everything above succeeded.
Remove-Item (Join-Path $dir 'managed-*.installed') -Force -ErrorAction SilentlyContinue
New-Item -ItemType File -Path (Join-Path $dir "managed-$configRevision.installed") -Force | Out-Null
Manual deployment script template
# Writes the Speakeasy device agent identity file (managed.json) for the# device's enrolled user. Runs as SYSTEM from an Intune Win32 app.
$ErrorActionPreference = 'Stop'
# Change this whenever the token or any value below changes. It names the# marker file that the app's detection rule checks for.$configRevision = 'CONFIG_REVISION'
# Intune does not expand {{mail}} inside scripts; this script fills it in.$template = @'{ "v": 1, "email": "{{mail}}", "org_token": "REPLACE_WITH_ORG_TOKEN", "org_slug": "example-corp", "org_name": "Example Corp", "auto_update": "AUTO_UPDATE_MODE"}'@
$dir = Join-Path $env:ProgramData 'Speakeasy'$file = Join-Path $dir 'managed.json'$daemon = Join-Path $env:ProgramFiles 'Speakeasy\speakeasyd.exe'
function Get-EnrolledUserEmail { # The UPN recorded at Intune enrollment. Readable as SYSTEM, even before # anyone has signed in. foreach ($key in Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Enrollments' -ErrorAction SilentlyContinue) { $upn = (Get-ItemProperty $key.PSPath -ErrorAction SilentlyContinue).UPN if ($upn -like '*@*') { return $upn } }
# Fallback: the signed-in user's cached Entra identity. $user = (Get-CimInstance Win32_ComputerSystem).UserName if ($user) { $sid = ([System.Security.Principal.NTAccount]$user).Translate([System.Security.Principal.SecurityIdentifier]).Value $cache = "HKLM:\SOFTWARE\Microsoft\IdentityStore\Cache\$sid\IdentityCache\$sid" $name = (Get-ItemProperty $cache -ErrorAction SilentlyContinue).UserName if ($name -like '*@*') { return $name } }
throw 'Could not determine the enrolled user''s email.'}
# Stop before touching the device if a placeholder was left in.$config = $template | ConvertFrom-Jsonif ($config.org_token -like 'REPLACE_*') { throw 'Set org_token before packaging this script.' }if ($config.auto_update -notin 'notify', 'automatic') { throw 'Set auto_update to "notify" or "automatic".' }
$json = $template.Replace('{{mail}}', (Get-EnrolledUserEmail))
# Write UTF-8 without a BOM. A BOM breaks strict JSON parsers.New-Item -ItemType Directory -Path $dir -Force | Out-Null[System.IO.File]::WriteAllText($file, $json, [System.Text.UTF8Encoding]::new($false))
# SYSTEM and Administrators get full control, Users get read-only access.# SIDs keep this working on any OS language. Inheritance is cut so the# ProgramData default that lets users create files does not apply.icacls $dir /inheritance:r /grant '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-32-545:(OI)(CI)RX' | Out-Nullicacls $file /inheritance:r /grant '*S-1-5-18:F' '*S-1-5-32-544:F' '*S-1-5-32-545:R' | Out-Null
# The daemon reads managed.json only at startup. On a first rollout the agent# is not installed yet and reads the file when it first starts. On a later# revision, restart it so the new values apply.if (Test-Path $daemon) { & $daemon -service restart if ($LASTEXITCODE -ne 0) { throw "speakeasyd restart failed with exit code $LASTEXITCODE." }}
# Replace any earlier revision marker last, once everything above succeeded.Remove-Item (Join-Path $dir 'managed-*.installed') -Force -ErrorAction SilentlyContinueNew-Item -ItemType File -Path (Join-Path $dir "managed-$configRevision.installed") -Force | Out-Null2. Download the Win32 Content Prep Tool. In PowerShell on the packaging machine, download the Win32 Content Prep Tool. This requires Git. The commands clone into a temporary folder, copy out the executable to the current folder, and remove the clone:
$toolDir = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().ToString())try { git clone --depth 1 https://github.com/microsoft/microsoft-win32-content-prep-tool.git $toolDir if ($LASTEXITCODE -ne 0) { throw 'Could not clone the Win32 Content Prep Tool.' } Copy-Item (Join-Path $toolDir 'IntuneWinAppUtil.exe') .\IntuneWinAppUtil.exe -ErrorAction Stop} finally { if (Test-Path $toolDir) { Remove-Item $toolDir -Recurse -Force }}3. Package and upload the script as a Win32 app. Stage the script alone in an empty folder (the packer bundles the whole folder), then package it:
.\IntuneWinAppUtil.exe -c <stage-folder> -s Deploy-SpeakeasyManagedJson.ps1 -o outIn Apps → Windows → Add → Windows app (Win32), upload the .intunewin and set:
- Install command:
%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Deploy-SpeakeasyManagedJson.ps1 - Uninstall command:
cmd.exe /c rmdir /s /q "%ProgramData%\Speakeasy" - Install behavior: System
- Detection rule: a File rule checking that
managed-CONFIG_REVISION.installedexists in%ProgramData%\Speakeasy. Use the same revision as the script. Intune uses detection rules to decide whether the app is already present, so checking only formanaged.jsonwould skip later configuration revisions. - Assignments: none. As a dependency it installs wherever the agent app does.
Token rotation. Change CONFIG_REVISION, re-package the script as a new config app, and replace the old config app in the agent app’s dependency list. Do not rely on supersedence alone: Intune does not interchange a superseding Win32 app with an app dependency. The revision-specific detection rule causes Intune to run the new script, which restarts an existing service after writing the updated configuration.
Leave the icacls grants in the script as they are. The file must stay readable by Users, or enrollment silently fails.
Deliver the identity file as a custom configuration profile. One profile serves the whole fleet: Intune fills in {{mail}} per device.
-
Save the following as
speakeasy-agent.mobileconfig, replacing theorg_tokenandorg_slugvalues and generating fresh UUIDs (uuidgen) for bothPayloadUUIDkeys:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>PayloadContent</key><array><dict><key>PayloadType</key><string>com.apple.ManagedClient.preferences</string><key>PayloadIdentifier</key><string>com.speakeasy.agent.preferences</string><key>PayloadUUID</key><string>REPLACE-WITH-UUID-1</string><key>PayloadVersion</key><integer>1</integer><key>PayloadContent</key><dict><key>com.speakeasy.agent</key><dict><key>Forced</key><array><dict><key>mcx_preference_settings</key><dict><key>v</key><integer>1</integer><key>email</key><string>{{mail}}</string><key>org_token</key><string>spk_org_…</string><key>org_slug</key><string>example-corp</string><key>auto_update</key><string>automatic</string></dict></dict></array></dict></dict></dict></array><key>PayloadDisplayName</key><string>Speakeasy device agent</string><key>PayloadIdentifier</key><string>com.speakeasy.agent.profile</string><key>PayloadScope</key><string>System</string><key>PayloadType</key><string>Configuration</string><key>PayloadUUID</key><string>REPLACE-WITH-UUID-2</string><key>PayloadVersion</key><integer>1</integer></dict></plist> -
In Devices → Configuration → Create → New policy, choose macOS and the Templates → Custom profile type, upload the file, and set Deployment channel to Device channel.
-
Assign it to the same group as the macOS agent app you create in Step 2.
-
Assign an idempotent macOS shell script to the same group and set Run script as signed-in user to No. Have it exit nonzero until both the managed preference and the agent are present, compare the preference file’s hash with a local last-loaded marker, and restart the console user’s daemon only when the hash changes:
launchctl kickstart -k "gui/$(id -u "$(stat -f%Su /dev/console)")/com.speakeasy.daemon". Record the marker only after a successful restart. The app and profile assignments have no documented delivery order. Configure a recurring Script frequency and retries so the script eventually reconciles initial delivery and later profile updates. Microsoft documents the available frequency and retry controls in Use shell scripts on macOS devices in Intune.
Keep {{mail}} lowercase: Intune doesn’t validate tokens, and {{Mail}} ships as a literal string. On a device, inspect the delivered profile with defaults read /Library/Managed\ Preferences/com.speakeasy.agent.
Fallback: a platform script. If the managed.json file path is required instead, use Devices → Scripts and remediations → Platform scripts → Add → macOS with a script that writes /Library/Application Support/Speakeasy/managed.json as root:wheel / 0644, then restarts the console user’s daemon. Three Intune-specific traps:
- Intune macOS scripts have no parameters and don’t expand
{{mail}}: the script has to resolve the email itself, and theorg_tokenlives in the script body. - Restart the daemon in the console user’s context, not as root:
launchctl kickstart -k "gui/$(id -u "$(stat -f%Su /dev/console)")/com.speakeasy.daemon". - Set Script frequency to a recurring interval rather than once, so rotated tokens reach devices.
Use an Intune Linux script to write /etc/speakeasy/managed.json as root:root / 0644, then follow the Linux guide to register and restart the per-user unit.
Step 2: Set up the line-of-business app
Section titled “Step 2: Set up the line-of-business app”The agent is deployed as one Intune app per platform. In Apps → All apps → Add, choose the app type for each platform in the fleet:
| Platform | App type | Installer (Step 3) |
|---|---|---|
| macOS | Line-of-business app | speakeasy-agent_<version>.pkg |
| Windows | Windows app (Win32) | speakeasy-agent_<version>.msi, wrapped as .intunewin |
On Windows, use Windows app (Win32) rather than a line-of-business MSI. The identity file from Step 1 is attached as an app dependency, and Intune only supports dependencies between Win32 apps.
Settings that are the same regardless of platform:
- Name and Publisher: use the same name on both apps (for example Speakeasy Device Agent / Speakeasy) so the dependency picker and the Company Portal both show one obvious entry per platform.
- Assignments: assign the app as Required to the device group that should run the agent. On Windows, the wizard’s Dependencies page (Step 3) comes before Assignments, so attach the identity-file app there first. Don’t assign the identity-file app from Step 1; as a dependency it installs wherever the agent app does.
Intune asks for the installer file on the first page of the wizard, so have the platform’s installer from Step 3 ready when creating each app.
Step 3: Add the installer for each platform
Section titled “Step 3: Add the installer for each platform”Windows
Section titled “Windows”-
In the dashboard, open Organization Settings → Secure → Device Agent, choose Windows under Install the agent, and download
speakeasy-agent_<version>.msi. You can also download the current one fromhttps://ai.speakeasy.com/rpc/install/device-agent-windows.msi; it redirects to the versioned file, so a browser saves it under that name. -
Stage the MSI alone in an empty folder and package it with the Win32 Content Prep Tool (
IntuneWinAppUtil.exe) from Step 1:Terminal window .\IntuneWinAppUtil.exe -c <stage-folder> -s speakeasy-agent_<version>.msi -o out -
Upload the resulting
.intunewinas the app package file for the Windows app created in Step 2, then set the Program page:- Install command:
msiexec /i speakeasy-agent_<version>.msi /qn /norestart - Uninstall command:
msiexec /x speakeasy-agent_<version>.msi /qn /norestart - Install behavior: System
- Device restart behavior: No specific action
- Install command:
-
On the Detection rules page, match the rule to the selected update owner:
- For Intune-controlled updates, use an MSI or other version-aware rule for each release so the superseding app installs the newer version.
- For agent-controlled updates, use a version-independent File rule that checks for
C:\Program Files\Speakeasy\speakeasyd.exe. An MSI ProductCode rule can become false after an automatic MajorUpgrade and make Intune offer the older package again.
-
On the Dependencies page, choose Add, select the identity-file app from Step 1, set Automatically install to Yes, and continue. Assign the agent app only after this dependency is attached.
Choose one owner for Windows updates. Keep auto_update on "notify" when Intune controls version moves through a new .intunewin that supersedes the previous one. Use "automatic" when the agent should verify and install signed MSI updates. Do not schedule both update paths at the same time. See Windows reference.
- In the dashboard, open Organization Settings → Secure → Device Agent, choose macOS under Install the agent, and download
speakeasy-agent_<version>.pkg. You can also download the current one fromhttps://ai.speakeasy.com/rpc/install/device-agent-macos.pkg; it redirects to the versioned file, so a browser saves it under that name. - Upload it as the app package file for the macOS line-of-business app created in Step 2.
Detection needs no custom rule: Intune’s app model checks the pkg’s own receipt (com.speakeasy.agent.pkg).
Install it once. With auto_update: "automatic" in the identity file (Step 1), the agent keeps the daemon, CLI, and app current on its own. Re-push the pkg only for a change to the install layout itself, not for routine releases.
Intune can’t register the agent’s per-user systemd unit from a root script, so install on Linux through configuration management: follow the Linux guide, which covers the binaries, the unit, and the root helper package. An Intune Linux script can still place the speakeasyd and speakeasy binaries in /opt/speakeasy/bin, the guide’s root-owned folder, if that helps.
Step 4: Verify on a device
Section titled “Step 4: Verify on a device”Run the agent CLI’s status command on a target device, in the enrolled user’s session. The CLI is not on PATH, so call it by full path:
- macOS:
"$HOME/Library/Application Support/Speakeasy/bin/speakeasy" status - Windows (PowerShell):
& "C:\Program Files\Speakeasy\speakeasy.exe" status - Linux:
~/.local/state/speakeasy/bin/speakeasy status, or/opt/speakeasy/bin/speakeasy statusfor a root-owned install
It should report the enrolled email with source: managed (surfaced in the agent UI as “Provisioned by IT”). If it reports source: local or source: none, the usual causes are file permissions that are too tight, the file at the wrong path, or the daemon not having restarted since the identity file was written. On Windows, the config app should also show as Installed in the agent app’s dependency status in Intune.
Step 5: Start the Windows tray UI at sign-in
Section titled “Step 5: Start the Windows tray UI at sign-in”Deploy a Startup shortcut for all users so the tray UI starts in each user’s session. Do not launch the UI from the System-context installer.
-
Save the following as
Deploy-SpeakeasyStartup.ps1:Terminal window $ErrorActionPreference = 'Stop'$startup = [Environment]::GetFolderPath('CommonStartup')$shell = New-Object -ComObject WScript.Shell$shortcut = $shell.CreateShortcut((Join-Path $startup 'Speakeasy.lnk'))$shortcut.TargetPath = 'C:\Program Files\Speakeasy\speakeasy-ui.exe'$shortcut.WorkingDirectory = 'C:\Program Files\Speakeasy'$shortcut.Save() -
Package the script alone in a Win32 app, using the Content Prep Tool from Step 1:
Terminal window .\IntuneWinAppUtil.exe -c <startup-stage-folder> -s Deploy-SpeakeasyStartup.ps1 -o out -
Upload it as a Windows app (Win32) with these settings:
- Install command:
%windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Deploy-SpeakeasyStartup.ps1 - Uninstall command:
cmd.exe /c del /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\Speakeasy.lnk" - Install behavior: System
- Detection rule: a File rule checking that
Speakeasy.lnkexists in%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup. - Assignments: none. Add this app as another dependency of the agent app, with Automatically install set to Yes.
- Install command:
-
After Intune reports the agent, identity-file app, and Startup app as installed, sign out and back in. Confirm the Speakeasy tray icon appears. The shortcut runs at sign-in, not immediately when Intune installs it.
There is currently no Microsoft Intune integration in the Speakeasy dashboard. No Entra app registration or Microsoft Graph credentials are needed for this deployment. Use Intune’s installation status and the device checks in Step 4 to verify the rollout.
Windows reference
Section titled “Windows reference”Details of the Windows install that are worth knowing but don’t change the steps above.
The service model differs from macOS. The daemon runs machine-wide as LocalSystem, not per-user, so standard users cannot stop it (better tamper resistance than the macOS Login Items toggle) while local admins can. Tool syncing still targets the active console user’s home (~/.claude, ~/.cursor, ~/.codex); with nobody signed in, the daemon idles rather than writing into the SYSTEM profile.
Version moves can be Intune-controlled or agent-controlled. For Intune-controlled updates, keep auto_update on "notify", package the newer MSI as a new .intunewin, add it as a new app version, or use Supersedence on the new app with Uninstall previous version set to No. For agent-controlled updates, use "automatic"; the daemon verifies the newer signed MSI and launches it through a detached Windows Installer process. The MSI’s MajorUpgrade stops the service, replaces the files, and starts it again without leaving an orphaned service entry. Do not schedule an Intune rollout at the same time as an automatic agent update. The MSI’s UpgradeCode is 368ec0a6-8862-4906-af34-8c3adb92c6e0, if inventory or supersedence tooling needs it.
Managed-layer enforcement needs nothing extra. Because the Windows daemon already runs as LocalSystem, it performs privileged writes in-process rather than through a separate root helper as macOS and Linux do. Setting a tool to "managed" lands its system configuration on the first reconcile, with no EnforcementPending window waiting on a package: %ProgramData%\OpenAI\Codex\requirements.toml (Codex), %ProgramData%\Cursor\hooks.json (Cursor), and %ProgramData%\ClaudeCode\managed-settings.json (Claude Code). Each is written SYSTEM-owned with a protected ACL (SYSTEM and Administrators full, Users read-only), the Windows equivalent of a root-owned 0644.
Daemon logs land in the SYSTEM profile when the agent runs as a service: C:\Windows\System32\config\systemprofile\AppData\Local\Speakeasy\Logs\. Run interactively, they go to %LOCALAPPDATA%\Speakeasy\Logs\ instead. Worth telling the support desk before they go hunting.
Scripted install without the MSI. An option for an air-gapped mirror or a custom install layout: resolve the version, URL, and SHA-256 of speakeasyd_<version>_windows_amd64.exe and speakeasy_<version>_windows_amd64.exe from the release manifest (never hardcode them), place the binaries under C:\Program Files\Speakeasy\, then run & "C:\Program Files\Speakeasy\speakeasyd.exe" -service install followed by -service start. Call it by that full path, because the folder is not on PATH. Write managed.json with the same ACL grant as the script above, restart the service on every run, and move versions by stopping the service, replacing the binaries, and starting it again. Those raw binaries are not signed, so browser downloads of them may draw a SmartScreen warning; Intune line-of-business installs are unaffected. The manifest covers the raw binaries; verify the MSI itself with Get-AuthenticodeSignature.