Intune conditional access
authentik: 2026.11.0+Enterprise
authentik can be configured to restrict access to specific services so that only devices that are managed by Microsoft Intune, and that are compliant in Intune, are allowed.
This works as follows:
- Intune deploys a client certificate to each device. The certificate contains the device's Intune device ID.
- When a user accesses authentik, their browser presents the certificate.
- The Endpoint stage verifies the certificate against the certificate authorities that are configured on the Microsoft Intune connector, and uses the device ID to find the device among the devices that were imported from Intune.
- A policy checks the compliance state of the device.
The Endpoint stage only identifies the device. It does not check whether the device is compliant in Intune, or whether the device belongs to the user who is logging in. Use a policy for these checks.
Prerequisites
- The Microsoft Intune connector must be configured in authentik, and must have synchronized your devices.
- A private certificate authority that issues certificates to devices through Intune, such as Microsoft Cloud PKI or Active Directory Certificate Services.
- authentik must receive client certificates, either from a reverse proxy or by terminating TLS itself. Refer to the Mutual TLS stage documentation for more information.
Configure Intune and devices
Create a SCEP or PKCS certificate profile in Intune and assign it to every device that requires conditional access. Refer to the Microsoft documentation for certificate profiles for more information.
Configure the certificate profile with the following settings:
- Certificate type:
User. Browsers only use certificates from the user's certificate store. - Subject alternative name: add an attribute of type
URIwith the valueID:Intune:GUID:{{DeviceId}}orID:Microsoft Endpoint Manager:GUID:{{DeviceId}}. - Extended key usage:
Client Authentication
authentik rejects certificates that do not have a subject alternative name, and only reads the device ID from a URI in the format ID:<name>:GUID:<device ID>. A certificate that only contains the device ID in its subject is not accepted.
The ID:<name>:GUID:<device ID> format is the subject alternative name URI scheme that Cisco ISE uses for Intune integration, which is commonly used in Intune SCEP and PKCS certificate profiles.
authentik matches the device ID against both the Intune device ID and the Entra ID device ID of the imported devices. You can therefore also use ID:Intune:GUID:{{AAD_Device_ID}} for devices that are joined to or registered with Entra ID.
Configure authentik
Add the certificate authority to the connector
- Export the certificate of the certificate authority that issues the device certificates in PEM format.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to System > Certificates and click Import Existing.
- Provide a name, paste the certificate into the Certificate field, and leave the Private Key field empty.
- Click Import.
- Navigate to Endpoint Devices > Connectors and edit the Microsoft Intune connector.
- Under Certificate authorities, select the certificate that you imported.
- Click Update.
Select the certificate authority that directly issues the device certificates. If you use an intermediate certificate authority, selecting only the root certificate authority is not sufficient, because authentik only receives the device's certificate.
If no certificate authorities are selected on the connector, the Client Certificates of the active brand are used. If authentik terminates TLS itself, the certificate authority must also be added to the brand, because authentik otherwise does not request a certificate from the browser.
Bind Endpoint stage to flow
The flow must have an Endpoint stage bound to it. This configuration applies to a specific flow, such as an authentication flow.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Flows and Stages > Flows.
- Select the flow that you want to modify.
- Open the Stage Bindings tab and click Create and bind stage.
- Select Endpoint Stage as the stage type, click Next, and configure the following settings:
- Name: provide a name for the stage
- Connector: select the Microsoft Intune connector
- Mode: set to
Device required
- Click Next.
- Select the order for the stage. Ensure that this places the Endpoint stage in the flow wherever you want device access to be checked.
- Click Finish.
With the Device required mode, the flow is denied if the browser does not present a valid certificate, or if the certificate does not belong to a device that was imported from Intune.
Require a compliant device
To only allow devices that are compliant in Intune, add a Deny stage with an expression policy after the Endpoint stage.
-
On the Stage Bindings tab of the flow, click Create and bind stage.
-
Select Deny Stage as the stage type, click Next, and configure the following settings:
- Name: provide a name for the stage
- Deny message: provide a message explaining why access was denied
-
Click Next.
-
Select the order for the stage. Ensure that this number is higher than the order of the Endpoint stage.
-
Click Finish.
-
Expand the Deny stage that you just created and click Create and bind Policy.
-
Select Expression policy as the policy type, click Next, and configure the following settings:
-
Name: provide a descriptive name for the policy
-
Expression:
flow_plan = request.context.get("flow_plan")device = flow_plan.context.get("device") if flow_plan else Noneif device is None:return Trueintune = device.facts.data.get("vendor", {}).get("intune.microsoft.com", {})if intune.get("compliance_state") != "compliant":ak_message("This device is not compliant in Microsoft Intune.")return Truereturn FalseDeny stageBecause this is a deny stage, the policy must evaluate true when a requirement is not met.
-
-
Click Next and then click Finish.
You can extend the expression with other device facts. For example:
- To also allow devices that are within their compliance grace period, check for
intune.get("compliance_state") not in ("compliant", "inGracePeriod"). - To only allow devices that are owned by your organization, check for
intune.get("managed_device_owner_type") != "company".
authentik synchronizes devices from Intune every 15 minutes. A change to the compliance state of a device in Intune only takes effect in authentik after the next synchronization.
Troubleshooting
- Certificate required but no certificate was given: the browser did not present a certificate, or the certificate could not be verified. Check that the certificate is installed in the user's certificate store, that it has a subject alternative name and the
Client Authenticationextended key usage, that it was issued by the certificate authority that is selected on the connector, and that your reverse proxy forwards client certificates to authentik. - Failed to find device: the certificate is valid, but no imported device has the device ID from the certificate. Check that the subject alternative name uses the format
ID:Intune:GUID:{{DeviceId}}orID:Microsoft Endpoint Manager:GUID:{{DeviceId}}, and that the device is shown under Endpoint Devices > Devices.