Add a UPN to SCEP certificates (Entra CBA and Android work-profile Wi-Fi)

Edited

Some Microsoft features match a certificate to a user by the User Principal Name (UPN) in the certificate's Subject Alternative Name (SAN). If your SCEP certificates don't include a UPN, those features fail. This article shows the one-line template change that adds it.

When you need this

  • Microsoft Entra certificate-based authentication (CBA). By default, Entra matches the certificate's Principal Name (the UPN) to the user's userPrincipalName. See Microsoft's guide, step 4: Configure the username binding policy.

  • Android Enterprise personally-owned work profile Wi-Fi in Intune. Microsoft notes that the Wi-Fi profile fails to deploy if the certificate has no UPN in the SAN. See Wi-Fi settings for Android Enterprise (Personally owned work profile > Enterprise).

Symptoms

  • The SCEP certificate profile installs, but the Wi-Fi profile that uses it fails (in Intune, often error -2016281112 / 0x87d1fde8).

  • Entra CBA sign-in can't find the user, even though the certificate is present.

  • When you inspect the certificate, the SAN has the user's email but no UPN entry.

Why it happens

Smallstep SCEP provisioners copy DNS, email, IP and URI SANs from the certificate request. A UPN in the request (for example {{UserPrincipalName}} in an Intune SCEP profile) isn't carried over unless the provisioner's certificate template adds it. Learn more: Certificate templates.

Before you start

  • Your UPNs match your email addresses. The change below copies the email from the request into the UPN. If your UPNs differ from email addresses, contact us first.

  • You're an Admin or Owner on your Smallstep team.

  • You have the step CLI installed.

  • You have two template files from Smallstep support: your current template (keep it as your fallback) and the updated one. Use the files as sent. Don't copy template text out of a web page, PDF or chat, which can add hidden characters such as curly quotes or Windows line endings that break the template.

What changes

One line. The template's sans line also adds a UPN taken from the email in the certificate request:

(dict "Type" "userPrincipalName" "Value" (first .Insecure.CR.EmailAddresses))

Nothing else in the template changes. Certificates already issued aren't affected. Only new certificates from that one provisioner get the UPN.

Steps

  1. Connect to the authority that issues the SCEP certificates. Use your authority URL and its root fingerprint (both are in the Smallstep console).

step ca bootstrap --ca-url https://<your-authority>.ca.smallstep.com --fingerprint <root-fingerprint>
  1. Apply the updated template to the SCEP provisioner. step opens a browser so you can sign in as an admin. Reference: step ca provisioner update.

step ca provisioner update <provisioner-name> --x509-template <updated-template>.json --admin-provisioner authority-admin
  1. Get a fresh certificate on a test device. Resend the SCEP profile from your MDM. In Fleet, resend it from the host's details page (Fleet's Smallstep guide). In Intune, sync the device or reassign the profile.

  2. Check the result. The new certificate's SAN should include a UPN, and the Wi-Fi profile or Entra sign-in should succeed.

To revert

Run step 2 again with your current (original) template file:

step ca provisioner update <provisioner-name> --x509-template <current-template>.json --admin-provisioner authority-admin

Things to watch

  • Device certificates from the same provisioner. If the provisioner also issues device certificates (requests with no email), confirm those still issue after the change. If they fail, revert and contact us.

  • Permission errors in step 2. Ask your team Owner to run the command.

Learn more

Was this article helpful?

Sorry about that! Care to tell us more?

Thanks for the feedback!

There was an issue submitting your feedback
Please check your connection and try again.