Autoconnect on logging in as an Entra ID user
You can configure FortiClient to automatically connect to a specified VPN tunnel using Microsoft Entra ID credentials.
FortiClient supports two autoconnect methods with Entra ID SAML VPN:
- FortiClient can establish the VPN tunnel seamlessly without manual authentication if the user is already logged in to an Entra ID domain-joined endpoint. See Method 1: Autoconnect with Entra ID domain-joined FortiClient endpoint.
- The user establishes the VPN tunnel using manual authentication for the first time that they establish that VPN tunnel. Afterward, FortiClient can seamlessly establish the VPN tunnel without manual authentication. See Method 2: Autoconnect with non Entra ID-joined FortiClient endpoint.
The following describes configuration for both methods.
The following instructions assume that you have already configured your Entra ID environment, that your FortiClient EMS and FortiGate are part of a Fortinet Security Fabric, and that the FortiGate has been configured in Azure as an enterprise application for SAML single sign on. See Tutorial: Azure AD SSO integration with FortiGate SSL VPN.
The following configuration requires FortiOS 7.2.1 or a later version.
The <use_gui_saml_auth>
XML option affects how FortiClient presents SAML authentication in the GUI. See SSL VPN.
Method 1: Autoconnect with Entra ID domain-joined FortiClient endpoint
To join the endpoint to an Entra ID domain:
- On the Windows machine, go to Settings > Accounts > Access work or school > Join this device to Microsoft ID.
- Enter the Entra ID domain account credentials.
- Reboot the endpoint.
- Log in with the configured Entra ID credentials.
To configure EMS:
- Go to Endpoint Profiles > Remote Access.
- Select the desired profile.
- Specify the desired tunnel as the autoconnect tunnel:
<vpn>
<options>
<autoconnect_tunnel>SSL VPN HQ</autoconnect_tunnel>
<autoconnect_on_install>1</autoconnect_on_install>
<options>
<vpn>
After the endpoint receives the updated configuration, when the user is logged in as the Entra ID domain user on the endpoint, FortiClient seamlessly connects to the VPN tunnel without displaying a prompt for credentials. The user does not need to manually authenticate the VPN tunnel connection.
To configure FortiOS:
conf user saml
edit "azure_saml"
set auth-url "https://graph.microsoft.com/v1.0/me"
next
end
Method 2: Autoconnect with non Entra ID-joined FortiClient endpoint
To create and configure app registration in Azure:
- In the Azure portal, go to Microsoft Entra ID > Enterprise applications.
- Select the FortiGate SSL VPN enterprise application.
- Note down the application ID and Azure domain.
- Go to Microsoft Entra ID > App registrations > All applications.
- Click the application that you selected in step 2.
- Go to Manage > Authentication > Add a platform > Mobile and desktop applications.
- In the Custom redirect URIs field, enter ms-appx-web://microsoft.aad.brokerplugin/, followed by the application ID that you noted. For example, if your application ID is 123456, enter ms-appx-web://microsoft.aad.brokerplugin/123456.
- Save the configuration.
To configure EMS:
- Go to Endpoint Profiles > Remote Access.
- Select the desired profile.
- Configure the following for the desired tunnel for FortiClient to automatically connect to. This example configures an SSL VPN tunnel as the tunnel that FortiClient automatically connects to. You can configure the autoconnect tunnel to be an IPsec VPN tunnel if desired. For details on how to find the tenant domain name and application ID from the Azure portal, see the following:
Configure the following in Advanced Settings:
- Toggle on Enable SAML Login.
- Ensure that Use External Browser as User-agent for SAML Login is disabled. You cannot use an eternal browser for this method.
- Toggle on Enable Azure Auto Login.
- In the Tenant Name field, enter the domain name obtained from the Azure portal.
- In the Client ID field, enter the application ID obtained from the Azure portal.
- Save the tunnel.
- In general VPN settings, specify the desired tunnel as the autoconnect tunnel:
<vpn>
<options>
<autoconnect_tunnel>SSL VPN HQ</autoconnect_tunnel>
<autoconnect_on_install>1</autoconnect_on_install>
<options>
<vpn>
To configure FortiOS:
You must define a user, msgraph, and use it as a member of User & Authentication > User Groups. The following shows the relevant CLI commands:
config user external-identity-provider edit "msgragh" set type ms-graph set version v1.0 next end
config user group edit "SSLVPN_SAML_Entra_ID" set authtimeout 60 set member "SSLVPN_SAML_Entra_ID" "msgragh" next end
config user saml
edit "azure_saml"
set auth-url "https://graph.microsoft.com/v1.0/me"
next
end
To configure EMS:
- Go to Endpoint Profiles > Remote Access.
- Select the desired profile.
- In XML view, configure the following for the desired tunnel for FortiClient to automatically connect to. This example configures an SSL VPN tunnel as the tunnel that FortiClient automatically connects to. You can configure the autoconnect tunnel to be an IPsec VPN tunnel if desired. For details on how to find the tenant domain name and application ID from the Azure portal, see the following:
<vpn>
<sslvpn>
<connections>
<connection>
<name>SSL VPN HQ</name>
<sso_enabled>1</sso_enabled>
<azure_auto_login>
<enabled>1</enabled>
<azure_app>
<tenant_name>Domain name obtained from the Azure portal.</tenant_name>
<client_id>Application ID obtained from the Azure portal</client_id>
</azure_app>
</azure_auto_login>
<connection>
<connections>
<sslvpn>
<vpn>
- In general VPN settings, specify the desired tunnel as the autoconnect tunnel:
<vpn>
<options>
<autoconnect_tunnel>SSL VPN HQ</autoconnect_tunnel>
<autoconnect_on_install>1</autoconnect_on_install>
<options>
<vpn>
To manage application permissions:
- As an end user, log in to an endpoint that has the profile configured in To configure EMS: applied.
- FortiClient automatically attempts to connect to the specified VPN tunnel. If this is the initial attempt to connect to this VPN tunnel, Windows displays a prompt to select the desired Entra ID account. Select the desired account.
You should now configure one of the following permission options. These steps assume that you have already configured Azure SAML SSL/IPsec VPN autoconnect as this document describes and you are signed in as a global administrator of the same tenant.
- To have Need admin approval shown to users, do the following:
- In the Azure portal, go to Enterprise Application > <Your VPN application> > (sidebar) Manage > Properties.
- Set Assignment required? to Yes.
- Add the desired users to Users & Groups.
- Remove any permissions in App Registration.
- Go to Home > App Registration > <Your VPN application> > (sidebar) Manage > API permissions.
- Right-click and remove permission.
- If you want to disallow user consent for all applications, you can disable this by doing the following:
- Go to Home > Enterprise Application > <Your VPN application> > (sidebar) Security > Consent and permissions > Manage > User consent settings.
- For User consent for applications, select Do not allow user consent.
- To have users consent per a permissions request but avoid admin approval, do the following:
- Go to Enterprise Application > <Your VPN application> > (sidebar) Manage > Properties.
- Set Assignment required? to No. This allows any valid user from this tenant to use the app. You no longer need to add users to Users and groups to have access to this app. As per Microsoft documentation, when an application requires assignment, user consent for that application is not allowed. This is true even if users consent for that app would have otherwise been allowed.
- Remove any permissions in App Registration.
- Go to Home > App Registration > <Your VPN application> > (sidebar) Manage > API permissions.
- Right-click and remove permission.
- Allow users to consent:
- Go to Home > Enterprise Application > <Your VPN application> > (sidebar) Security > Consent and permissions > Manage > User consent settings.
- Select User consent for applications > Allow user consent for apps from verified publishers for selected permissions.
- Go to Manage > Permission classifications.
- Ensure the following are listed under Low-risk permissions > Microsoft Graph:
- User.Read
- offline_access
- profile
- openid
The next time that the Entra ID user signs in with FortiClient Entra ID autoconnect triggered, the user should see a popup requesting permissions.
- To grant admin consent to an enterprise application such that a user does not need to request consent, do one of the following:
- To grant this consent through the standard permission UI as a global administrator, do the following:
- Connect to the VPN. You are prompted as usual to grant permissions for your user account to the enterprise application.
- As a global administrator, there is an extra Consent on behalf of your organization checkbox. Select it to grant admin consent to the application. Other users do not need to grant consent.
- To grant this consent in the Azure portal, do the following:
- Go to Enterprise Application > <Your VPN application> > (sidebar) Security > Permissions.
- Click app registration in the sentence To configure requested permissions for apps you own, use the app registration.
- Go to API Permissions > Configured permissions > Add a permission > Request API permissions > Microsoft APIs > Microsoft Graph > Delegated Permissions.
- Select the following:
- openID permissions:
- offline_access
- openid
- profile
- User > User.Read
- openID permissions:
- Add the permissions.
- After the permissions are added, they appear in the table on the same screen. Click Grant admin consent for <Tenant name>.
- Return to Enterprise Applications Permissions by clicking Enterprise applications in the sentence To view and manage consented permissions for individual apps, as well as your tenant's consent settings, try Enterprise applications.
- The Grant admin consent for <Tenant name> button is blue instead of being grayed out. Click the button. A popup opens that requires you to sign in as a global administrator and to allow the application permissions. The permissions that you used in App Permissions fill in the following table.
After you complete either step, users no longer need to request consent and can autoconnect to VPN without having to give consent.
- To grant this consent through the standard permission UI as a global administrator, do the following:
The prompt to grant permissions does not appear if the Azure domain or tenant administrator has already granted permission on behalf of the organization. |