Autoconnect on logging in as an Entra ID user
You can configure FortiClient to automatically connect to a specified VPN tunnel immediately after it installs and receives its configuration from EMS. In this example, FortiClient authenticates the connection using Microsoft Entra ID credentials. When the user logs in to Windows using their Entra ID credentials, FortiClient silently and automatically connects to the specified VPN tunnel, without the user needing to reenter their credentials or open the FortiClient console.
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: Microsoft Entra SSO integration with FortiGate SSL VPN.
The following configuration requires FortiOS 7.2.1 or a later version.
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 FortiOS:
conf 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:
<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. |