Felix Cloud/Insights
FortiGate IKEv2 VPN with Microsoft Entra ID sign-in and MFA.
A complete admin setup guide for a remote-access VPN where staff sign in with their Microsoft account: public DNS, a free certificate, the Entra app, every FortiGate CLI block, FortiClient, testing and troubleshooting.

This is the build we use for small offices that want remote access without another password. Staff open FortiClient, sign in with their Microsoft account and MFA, and reach the office network over an IKEv2 tunnel. Who may connect is decided by membership of one Entra security group.
- Microsoft sign-in with MFA. The FortiGate hands authentication to Entra ID over SAML, then checks the user's group once, at connect.
- One group controls access. Add or remove a member in Entra. Nothing changes on the firewall.
- Free pieces. FortiGuard DDNS, a Let's Encrypt certificate that renews itself, and the free FortiClient VPN on Windows and Mac.
- Split tunnel. Only office traffic uses the VPN. Internet traffic stays on the user's own connection.
Example values
| Item | Value |
|---|---|
| VPN name (users, Entra, FortiClient) | vpn.northwind.example |
| Public DNS | CNAME vpn → northwind-vpn.fortiddns.com. (FortiGuard DDNS) → WAN IP |
| WAN | wan — PPPoE, public IP (203.0.113.25 in this example), no NAT in front |
| LAN | lan — 192.168.50.0/24 |
| VPN client pool | 10.210.1.1 – 10.210.1.254 |
| DNS for VPN clients | 1.1.1.1, 8.8.8.8 (this example has no server or Active Directory on site) |
| SAML (sign-in) port | TCP 24443 |
| Certificate | LE-VPN — Let's Encrypt, CN vpn.northwind.example, renews itself |
| Entra tenant ID | 11111111-2222-3333-4444-555555555555 |
| Entra app | Northwind FortiGate VPN (gallery app "FortiGate SSL VPN") |
| Entra group | SG-VPN-Users · Object ID aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee |
| Entra signing cert on FortiGate | REMOTE_Cert_1 |
| FortiGate objects | SAML server Entra-VPN · group GRP-VPN-Entra · tunnel DU-VPN · policy IKEv2-SAML-VPN-to-LAN |
| Pre-shared key | Stored in your password manager only, never in a document, email or chat |
How it works
FortiClient ──(1) TCP 24443──► FortiGate ──(2) redirect──► Microsoft Entra sign-in + MFA
▲ │
│ (3) signed SAML answer: username + group ID
│ ▼
└──(4) IKEv2 on UDP 500/4500, EAP with the sign-in token ──► FortiGate checks group
aaaaaaaa-… = SG-VPN-Users
Connected: client gets 10.210.1.x, routes only 192.168.50.0/24 through the tunnel.- Who may connect is decided only by membership of SG-VPN-Users, checked once at connect (phase 1
authusrgrp). - The firewall policy has no user groups. Once connected, traffic to the LAN is allowed. Group matching on the policy blocks all traffic after connect.
- Split tunnel: only office traffic uses the VPN; internet traffic stays on the user's own connection.
Public DNS: FortiGuard DDNS and CNAME
The WAN IP is dynamic (PPPoE). FortiGuard DDNS keeps northwind-vpn.fortiddns.com pointing to the current IP. The company's own name vpn.northwind.example is a CNAME to it, so users, Entra and the certificate all use the company domain.
3.1 FortiGuard DDNS on the FortiGate
GUI: Network → DNS → FortiGuard DDNS → on, interface wan, name northwind-vpn, domain fortiddns.com. CLI equivalent:
config system ddns
edit 1
set ddns-server FortiGuardDDNS
set server-type ipv4
set ddns-domain "northwind-vpn.fortiddns.com"
set monitor-interface "wan"
next
endRequires the FortiGate to be registered (FortiCare). Check: show system ddns, and from any PC nslookup northwind-vpn.fortiddns.com 8.8.8.8 → current WAN IP.
get system interface physical: wan shows 203.0.113.25 in PPPoE mode. If an ISP modem ever does NAT in front (WAN shows 192.168.x / 10.x), put the modem in bridge mode, or forward UDP 500, UDP 4500, TCP 24443 and TCP 443, and set set use-public-ip enable in the DDNS entry.3.2 CNAME in the company's DNS
| Type | Host / Name | Target / Address | TTL |
|---|---|---|---|
| CNAME | vpn | northwind-vpn.fortiddns.com. ← with the trailing dot | 5 minutes |
northwind-vpn.fortiddns.com.northwind.example and lookups returned "Non-existent domain". The panel warns "No trailing dot! Click to add dot" — always add it. In the Host field enter only vpn.Check from any PC:
nslookup vpn.northwind.example 8.8.8.8 Name: northwind-vpn.fortiddns.com Address: 203.0.113.25 Aliases: vpn.northwind.example
If Google still answers "Non-existent domain" right after a fix, it is caching the earlier answer; test with 1.1.1.1 or wait up to an hour.
3.3 Why CNAME rather than the DDNS name alone
| DDNS name only | CNAME (used here) | |
|---|---|---|
| Name users see | fortiddns.com (Fortinet's domain) | the company's own domain |
| Certificate options | Let's Encrypt only | Let's Encrypt or the company's wildcard |
| FortiGate replaced / DDNS name lost | New name: redo Entra, SAML, certificate and every FortiClient | Point the CNAME at the new target; nothing else changes |
| Static IP later | Same rework | Change the CNAME to an A record |
The DDNS-only variant is described in Appendix A.
Certificate: Let's Encrypt (or wildcard)
The Microsoft sign-in starts on the FortiGate at https://vpn.northwind.example:24443, in the user's browser, so it needs a trusted certificate for exactly that name. There are two free options; this guide uses Let's Encrypt.
4.1 Let's Encrypt on the FortiGate
Before requesting:
- The name must already resolve publicly to the WAN IP (section 3.2). A request for a name that does not resolve fails.
- Let's Encrypt must reach the FortiGate on the WAN to validate it (TCP 443 per Fortinet's ACME documentation): no VIP/port forward on 443 to an internal server and no admin HTTPS on 443 on
wan.
GUI: System → Certificates → Create/Import → Certificate → Use Let's Encrypt, domain vpn.northwind.example, email = admin mailbox, ACME interface wan. CLI:
config system acme
set interface "wan"
end
config vpn certificate local
edit "LE-VPN"
set enroll-protocol acme2
set acme-domain "vpn.northwind.example"
set acme-email "[email protected]"
nextAt "Do you want to continue? (y/n)" (Let's Encrypt terms) type y by hand, then type end.
end is pasted together with the block, its first letter answers the y/n prompt, the request is cancelled ("Command cancelled by user") and nothing is saved. The email must be a real address — a placeholder gives "is not a valid email address".Check after about a minute:
get vpn certificate local details LE-VPN
Subject: CN = vpn.northwind.example
Issuer: C = US, O = Let's Encrypt, CN = YR1
Valid to: 2027-02-21
ACME details:
Status: finished, notifiedCN = northwind-vpn.fortiddns.com, which is wrong for the CNAME design (browsers warn). The name column in the GUI is only a label; the CN/SAN is what counts. Delete any such certificate when its Ref. count is 0.Renewal: automatic, about every 60 days, same certificate name, so nothing needs re-pointing. It keeps working as long as the name resolves and TCP 443 on the WAN stays free.
4.2 Alternative: the company's existing wildcard
If the company already owns *.northwind.example and the private key is available:
- Export a PFX: on the Windows server where it is installed,
certlm.msc→ Personal → Certificates → the wildcard → All Tasks → Export → Yes, export the private key → include all certificates in the path → set a password. (Or download certificate, key and CA bundle from the provider.) - FortiGate: System → Certificates → Create/Import → Certificate → Import Certificate → PKCS#12 → name e.g.
WILDCARD-VPN. Import the intermediate under CA Certificate if it was not included. - Use that name wherever this guide uses
LE-VPN.
No automatic renewal: import the renewed wildcard each year and re-point the two settings (6.1 and 6.2). A wildcard does not cover the fortiddns.com name, so it only works with the CNAME design.
Microsoft Entra ID
5.1 Security group
Entra admin center → Groups → New group: Group type Security · name SG-VPN-Users · Membership type Assigned · Entra roles can be assigned: No. Object ID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.
Not mail-enabled: a mail-enabled security group is managed in Exchange, so members cannot be added in Entra, and it would appear in the address book. A Microsoft 365 group would work but creates a mailbox and site that are not needed.
5.2 Enterprise app
Enterprise applications → New application → gallery FortiGate SSL VPN → name Northwind FortiGate VPN → Create → Single sign-on → SAML → Basic SAML Configuration:
| Field | Value |
|---|---|
| Identifier (Entity ID) | https://vpn.northwind.example:24443/remote/saml/metadata/ (keep the final /) |
| Reply URL (ACS) | https://vpn.northwind.example:24443/remote/saml/login |
| Sign on URL | https://vpn.northwind.example:24443/remote/saml/login |
| Logout URL | https://vpn.northwind.example:24443/remote/saml/logout |
5.3 Attributes & Claims — must end up exactly like this
| Claim name | Value shown | How |
|---|---|---|
username | user.userprincipalname (no quotes) | Source Attribute; pick the attribute from the dropdown |
group | user.groups | Group claim: Groups assigned to the application · source Group ID · Advanced → Customize the name → group, namespace empty |
"user.userprincipalname"in quotes = Source "Constant": every user sends that literal text. Fix: Source Attribute + choose from the list.- Group claim left as "Security groups" with the default long name
http://schemas.microsoft.com/ws/2008/06/identity/claims/groups: the FortiGate looks forgroupand finds nothing. "Add a group claim" is greyed out once one exists — edit the existing one.
5.4 Certificate, assignment, access
- SAML Certificates → Certificate (Base64) → Download. On the FortiGate: System → Certificates → Create/Import → Remote Certificate → upload → it becomes
REMOTE_Cert_1(CN = Microsoft Azure Federated SSO Certificate). - Users and groups → + Add user/group → SG-VPN-Users → Assign.
- Properties → Assignment required? = Yes (only after step 2). Non-members then get a clear Microsoft error instead of a silent hang.
- Conditional Access: require MFA for Northwind FortiGate VPN.
- Give users access by adding them as direct members of SG-VPN-Users.
FNBAM_DENIED) and FortiClient keeps "connecting" with no error.FortiGate configuration (CLI)
6.0 Pre-checks
show firewall vip (nothing may use 24443 or 443 on the WAN IP) get system global | grep -i port (admin ports must not be 24443)
6.1 SAML port and certificate
config system global
set auth-ike-saml-port 24443
end
config user setting
set auth-cert "LE-VPN"
end6.2 SAML server
config user saml
edit "Entra-VPN"
set cert "LE-VPN"
set entity-id "https://vpn.northwind.example:24443/remote/saml/metadata/"
set single-sign-on-url "https://vpn.northwind.example:24443/remote/saml/login"
set single-logout-url "https://vpn.northwind.example:24443/remote/saml/logout"
set idp-entity-id "https://sts.windows.net/11111111-2222-3333-4444-555555555555/"
set idp-single-sign-on-url "https://login.microsoftonline.com/11111111-2222-3333-4444-555555555555/saml2"
set idp-single-logout-url "https://login.microsoftonline.com/11111111-2222-3333-4444-555555555555/saml2"
set idp-cert "REMOTE_Cert_1"
set user-name "username"
set group-name "group"
set digest-method sha256
next
end6.3 User group (checked at connect only)
config user group
edit "GRP-VPN-Entra"
set member "Entra-VPN"
config match
edit 1
set server-name "Entra-VPN"
set group-name "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
next
end
next
end6.4 SAML on the WAN · 6.5 Address objects
config system interface
edit "wan"
set ike-saml-server "Entra-VPN"
next
end
config firewall address
edit "VPN-Pool"
set subnet 10.210.1.0 255.255.255.0
next
edit "Office-LAN"
set subnet 192.168.50.0 255.255.255.0
next
end6.6 Phase 1
config vpn ipsec phase1-interface
edit "DU-VPN"
set type dynamic
set interface "wan"
set ike-version 2
set peertype any
set net-device disable
set mode-cfg enable
set proposal aes256gcm-prfsha384 aes256-sha256
set dhgrp 20 14
set eap enable
set eap-identity send-request
set authusrgrp "GRP-VPN-Entra"
set ipv4-start-ip 10.210.1.1
set ipv4-end-ip 10.210.1.254
set ipv4-netmask 255.255.255.0
set dns-mode manual
set ipv4-dns-server1 1.1.1.1
set ipv4-dns-server2 8.8.8.8
set ipv4-split-include "Office-LAN"
set client-auto-negotiate enable
set client-keep-alive enable
set transport udp
set dpd on-idle
set dpd-retryinterval 30
set dpd-retrycount 5
set keepalive 10
set psksecret <PSK from your password manager>
next
endPSK: long random string without spaces or ?. transport exists from FortiOS 7.4.2. set domain is IKEv1-only; it is not used here (no internal domain).
6.7 Phase 2 · 6.8 Firewall policy (no user groups)
config vpn ipsec phase2-interface
edit "DU-VPN"
set phase1name "DU-VPN"
set proposal aes256gcm aes256-sha256
set dhgrp 20 14
next
end
config firewall policy
edit 0
set name "IKEv2-SAML-VPN-to-LAN"
set srcintf "DU-VPN"
set dstintf "lan"
set srcaddr "VPN-Pool"
set dstaddr "Office-LAN"
set action accept
set schedule "always"
set service "ALL"
set logtraffic all
set nat enable
next
endedit 0takes the next free policy ID; move the policy above any deny rules.nat enable: LAN devices see VPN users as the FortiGate's LAN IP, so printers/PCs need no return route and "local subnet" firewall rules apply.- No security profiles are set here. Add antivirus and IPS profiles if the unit has a UTM licence.
- To limit access, narrow
dstaddr/service— never add user groups to this policy.
Testing and debugging
7.1 From a PC outside the office
nslookup vpn.northwind.example → 203.0.113.25 Test-NetConnection vpn.northwind.example -Port 24443 → TcpTestSucceeded : True Browser: https://vpn.northwind.example:24443 → valid padlock (Let's Encrypt)
7.2 On the FortiGate after connecting
diagnose vpn tunnel list | grep -v key (never paste tunnel output with keys anywhere) diagnose firewall auth list
7.3 Debug — start BEFORE the user clicks Connect
diagnose debug reset diagnose vpn ike log filter clear diagnose vpn ike log filter rem-addr4 <user's public IP> diagnose debug console timestamp enable diagnose debug application samld -1 diagnose debug application ike -1 diagnose debug enable ... user connects, signs in, waits 30 s ... diagnose debug disable diagnose debug reset
| In the output | Meaning |
|---|---|
samld lines contain aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee | Entra sends the group correctly |
No group attribute in the samld output | User not a direct member of SG-VPN-Users, or the group claim is wrong (5.3) |
FNBAM_DENIED / EAP failed | Group check failed (same as above) |
| No lines from the user's IP at all | Packets don't reach the FortiGate: wrong address/port in FortiClient, or the user's network blocks UDP 500/4500 (test on a phone hotspot) |
INVALID_KE then a second SA_INIT | Normal: client offered DH 14 first, FortiGate asked for 20 |
Replace <user's public IP> with the real address — the literal text gives "command parse error". The IKE debug prints session keys (SK_ei etc.); they are useless after the session ends, but do not post captures publicly.
FortiClient
Free FortiClient VPN — Windows https://links.fortinet.com/forticlient/win/vpnagent, Mac https://links.fortinet.com/forticlient/mac/vpnagent (7.4.3 or newer on Mac; tested 7.4.4).
| Field | Value |
|---|---|
| VPN / Connection Name | IPsec VPN · Northwind VPN |
| Remote Gateway | vpn.northwind.example |
| Authentication | Pre-shared key (from your password manager) |
| SSO for VPN Tunnel · Customize port · external browser | ✔ · ✔ 24443 · ✔ |
| Advanced: VPN settings | IKE Version 2, Mode Config |
| Phase 1 | AES256GCM+PRFSHA384 and AES256+SHA256 · DH 14 and 20 · DPD ✔ · NAT-T ✔ · Local ID empty |
| EAP | ✔ · Prompt on login |
| Phase 2 | AES256+SHA256 · Replay ✔ · PFS ✔ · DH 14 · key life 43200 |
Roll-out: configure one PC, export a password-protected .conf (Settings → padlock → Backup), give users the file and its password separately, plus a short user guide.
RDP to office PCs over the VPN
- Connect to PCs by IP (e.g.
192.168.50.205). The VPN gives public DNS, so office PC names do not resolve. - Entra accounts sign in with email + password in the normal RDP prompt only from a PC joined to the company's Entra tenant. From a PC in another tenant (e.g. the MSP's own laptop) the same credentials fail with "The logon attempt failed".
- From a PC outside the tenant:
mstsc→ Show Options → Advanced → Use a web account to sign in to the remote computer, connect by the PC's name (hosts-file entry needed), and run it from a Windows profile that is not signed in to another Entra tenant (otherwise the sign-in picks that account). - Local accounts work from anywhere.
Allow an Entra user to RDP into a workstation
On the workstation, signed in as that Entra user:
whoami → e.g. AzureAD\JohnSmith
In an elevated Command Prompt:
net localgroup "Remote Desktop Users" /add "AzureAD\JohnSmith"
net localgroup "Remote Desktop Users" (verify)
Connect: mstsc → 192.168.50.x → user's Entra email + passwordThe whoami name can differ from the email address — add the whoami value, sign in with the email. If the IP of a target PC changes (new DHCP lease), check its current IP first; reserve the IP in the FortiGate DHCP server if it becomes a nuisance.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
nslookup: Non-existent domain | CNAME target without trailing dot, or record not saved / wrong DNS provider | Target northwind-vpn.fortiddns.com.; host vpn; check nslookup -type=ns northwind.example |
| Browser warns on the certificate | Certificate issued for another name (fortiddns) | Use LE-VPN (CN vpn.northwind.example) in 6.1 and 6.2 |
| Let's Encrypt request cancelled | end pasted with the block answered the y/n prompt | Type y by hand, then end |
| Let's Encrypt fails / stops renewing | Name doesn't resolve, or 443 on the WAN used by a VIP/admin | Fix DNS; free TCP 443 on wan |
| Entra error AADSTS50011 | Reply URL / Identifier mismatch | URLs exactly as 5.2 (final / on the Identifier) |
| Microsoft sign-in OK, FortiClient keeps connecting, no error | User not a direct member of SG-VPN-Users (assigned directly/nested), or group claim wrong | Add to SG-VPN-Users; check 5.3; shut down and reopen FortiClient; debug 7.3 |
| Microsoft error AADSTS50105 | User not in SG-VPN-Users (Assignment required = Yes) | Add the user to the group |
| Negotiation Failed / IkeSa_Failed | Wrong gateway/port, or UDP 500/4500 blocked on the user's network | Check profile; test on a hotspot; capture on wan |
| Connected but LAN unreachable, drops after ~1 min (Dpd_RetryMaximum) | User group added to the firewall policy | unset groups on the policy |
| Choppy / dropping connection | Some ISPs drop inbound UDP 4500 in bursts | diagnose sniffer packet wan 'host <user IP> and udp port 4500' 4 on both ends; ISP ticket if packets are missing |
| Mac: fails at once / IKEv2 greyed out | FortiClient older than 7.4.3 | Install the current free version |
| RDP with Entra account: "logon attempt failed" | Connecting PC not in the company's tenant | Section 9 |
Maintenance
| Task | When | Action |
|---|---|---|
| User access | Ongoing | Add/remove members of SG-VPN-Users only — no FortiGate change |
| Certificate | Automatic | Check get vpn certificate local details LE-VPN after FortiOS upgrades and if users see a warning |
| Entra signing certificate | Before its expiry (shown in the app) | Download the new one, import as Remote Certificate, update idp-cert in Entra-VPN |
| PSK | Staff change / leak | New PSK in phase 1 + re-issue the FortiClient .conf |
| Config backup | After changes | Backup the FortiGate config; keep the PSK and backups in your password manager |
| FortiClient | Yearly | Keep users on the current free 7.4.x |
DDNS-only option (no CNAME)
Use this only when the company's DNS cannot be edited. Everything in this guide stays the same except the name and the certificate:
| Where | Use instead |
|---|---|
| DNS | No CNAME. FortiGuard DDNS as in 3.1 |
| Certificate | Let's Encrypt for northwind-vpn.fortiddns.com: set acme-domain "northwind-vpn.fortiddns.com", e.g. name LE-VPN-DDNS. The company wildcard cannot be used. |
| 6.1 / 6.2 | auth-cert and cert = LE-VPN-DDNS |
| Entra 5.2 and SAML server 6.2 | Every vpn.northwind.example → northwind-vpn.fortiddns.com |
| FortiClient Remote Gateway | northwind-vpn.fortiddns.com |
Before you call it done
Back up the FortiGate configuration, store the pre-shared key and the backup in your password manager, and add a calendar reminder for the Entra signing certificate's expiry date. Everything else in this design looks after itself.
Rather not spend a day in the CLI?
Felix Cloud deploys and manages FortiGate VPNs with Entra ID sign-in, including the user roll-out.
Talk to Felix
Want this set up for you?
We design, deploy and manage FortiGate VPNs with Microsoft Entra ID sign-in. You get a plain-language plan and a quote, with no obligation.
- +1 (866) FELIX-1TToll-free
- +1 (647) 494-9872Toronto
- [email protected]We reply within one business day
- 1070 Sheppard Ave West, North York, ON M3J 0G8Felix IT Solutions Inc.
