Tutorial: Configure F5 BIG-IP Access Policy Manager for header-based single sign-on
Learn to implement secure hybrid access (SHA) with single sign-on (SSO) to header-based applications, using F5 BIG-IP advanced configuration. BIG-IP published applications and Microsoft Entra configuration benefits:
- Improved Zero Trust governance through Microsoft Entra preauthentication and Conditional Access
- Full SSO between Microsoft Entra ID and BIG-IP published services
- Managed identities and access from one control plane
- See, the Microsoft Entra admin center
Learn more:
Scenario description
For this scenario, there's a legacy application using HTTP authorization headers to control access to protected content. Ideally, Microsoft Entra ID manages application access. However, legacy lacks a modern authentication protocol. Modernization takes effort and time, while introducing downtime costs and risks. Instead, deploy a BIG-IP between the public internet and the internal application to gate inbound access to the application.
A BIG-IP in front of the application enables overlay of the service with Microsoft Entra preauthentication and header-based SSO. The configuration improves the application security posture.
Scenario architecture
The secure hybrid access solution for this scenario is made up of:
- Application - BIG-IP published service to be protected by Microsoft Entra SHA
- Microsoft Entra ID - Security Assertion Markup Language (SAML) identity provider (IdP) that verifies user credentials, Conditional Access, and SSO to the BIG-IP
- With SSO, Microsoft Entra ID provides the BIG-IP required session attributes, including user identifiers
- BIG-IP - reverse-proxy and SAML service provider (SP) to the application, delegating authentication to the SAML IdP, before header-based SSO to the back-end application
The following diagram illustrates the user flow with Microsoft Entra ID, BIG-IP, APM, and an application.
- User connects to application SAML SP endpoint (BIG-IP).
- BIG-IP APM access policy redirects user to Microsoft Entra ID (SAML IdP).
- Microsoft Entra preauthenticates user and applies ConditionalAccess policies.
- User is redirected to BIG-IP (SAML SP) and SSO occurs using issued SAML token.
- BIG-IP injects Microsoft Entra attributes as headers in request to the application.
- Application authorizes request and returns payload.
Prerequisites
For the scenario you need:
- An Azure subscription
- If you don't have one, get an Azure free account
- One of the following roles: Cloud Application Administrator, or Application Administrator
- A BIG-IP or deploy a BIG-IP Virtual Edition (VE) in Azure
- Any of the following F5 BIG-IP licenses:
- F5 BIG-IP® Best bundle
- F5 BIG-IP Access Policy Manager™ (APM) standalone license
- F5 BIG-IP Access Policy Manager™ (APM) add-on license on a BIG-IP F5 BIG-IP® Local Traffic Manager™ (LTM)
- 90-day BIG-IP full feature trial. See, Free Trials.
- User identities synchronized from an on-premises directory to Microsoft Entra ID
- An SSL certificate to publish services over HTTPS, or use default certificates while testing
- See, SSL profile
- A header-based application or an IIS header app for testing
BIG-IP configuration method
The following instructions are an advanced configuration method, a flexible way to implement SHA. Manually create BIG-IP configuration objects. Use this method for scenarios not included in the Guided Configuration templates.
Note
Replace example strings or values with those from your environment.
Add F5 BIG-IP from the Microsoft Entra gallery
Tip
Steps in this article might vary slightly based on the portal you start from.
To implement SHA, the first step is to set up a SAML federation trust between BIG-IP APM and Microsoft Entra ID. The trust establishes the integration for BIG-IP to hand off preauthentication and Conditional Access to Microsoft Entra ID, before granting access to the published service.
Learn more: What is Conditional Access?
Sign in to the Microsoft Entra admin center as at least a Cloud Application Administrator.
Browse to Identity > Applications > Enterprise applications > All applications.
On the top ribbon, select + New application.
In the gallery, search for F5.
Select F5 BIG-IP APM Microsoft Entra ID integration.
Enter an application Name.
Select Add/Create.
The name reflects the service.
Configure Microsoft Entra SSO
The new F5 application properties appear
Select Manage > Single sign-on
On the Select a single sign-on method page, select SAML.
Skip the prompt to save the single sign-on settings.
Select No, I'll save later.
On Set up single sign-on with SAML, for Basic SAML Configuration, select the pen icon.
Replace the Identifier URL with the BIG-IP published service URL. For example,
https://mytravel.contoso.com
Repeat for Reply URL and include the APM SAML endpoint path. For example,
https://mytravel.contoso.com/saml/sp/profile/post/acs
Note
In this configuration, the SAML flow operates in IdP mode: Microsoft Entra ID issues the user a SAML assertion before being redirected to the BIG-IP service endpoint for the application. The BIG-IP APM supports IdP and SP modes.
For Logout URI enter the BIG-IP APM Single Logout (SLO) endpoint, prepended by the service host header. The SLO URI ensures user BIG-IP APM sessions end after Microsoft Entra sign-out. For example,
https://mytravel.contoso.com/saml/sp/profile/redirect/slr
Note
From Traffic Management operating system (TMOS) v16 onward, the SAML SLO endpoint changed to
/saml/sp/profile/redirect/slo
.Select Save.
Exit SAML configuration.
Skip the SSO test prompt.
To edit the User Attributes & Claims > + Add new claim, select the pen icon.
For Name select Employeeid.
For Source attribute select user.employeeid.
Select Save
- Select + Add a group claim
- Select Groups assigned to the application > Source Attribute > sAMAccountName.
- Select Save the configuration.
- Close the view.
- Observe the User Attributes & Claims section properties. Microsoft Entra ID issues users properties for BIG-IP APM authentication and SSO to the back-end application.
Note
Add other claims the BIG-IP published application expects as headers. More defined claims are issued if they're in Microsoft Entra ID. Define directory memberships and user objects in Microsoft Entra ID before claims can be issued. See, Configure group claims for applications by using Microsoft Entra ID.
- In the SAML Signing Certificate section, select Download.
- The Federation Metadata XML file is saved on your computer.
SAML signing certificates created by Microsoft Entra ID have a lifespan of three years.
Microsoft Entra authorization
By default, Microsoft Entra ID issues tokens to users granted access to an application.
- In the application's configuration view, select Users and groups.
- Select + Add user and in Add Assignment, select Users and groups.
- In the Users and groups dialog, add the user groups authorized to access the header-based application.
- Select Select.
- Select Assign.
Microsoft Entra SAML federation trust is complete. Next, set up BIG-IP APM to publish the web application, configured with properties to complete SAML preauthentication trust.
Advanced configuration
Use the following sections to configure SAML, header SSO, access profile, and more.
SAML configuration
To federate the published application with Microsoft Entra ID, create the BIG-IP SAML service provider and corresponding SAML IdP objects.
Select Access > Federation > SAML Service Provider > Local SP Services > Create.
Enter a Name.
Enter the Entity ID defined in Microsoft Entra ID.
For SP Name Settings, make selections if the Entity ID doesn't match the hostname of the published URL, or make selections if it isn't in regular hostname-based URL format. Provide the external scheme and application hostname if entity ID is
urn:mytravel:contosoonline
.Scroll down to select the new SAML SP object.
Select Bind/UnBind IdP Connectors.
Select Create New IdP Connector.
From the drop-down, select From Metadata.
Browse to the federation metadata XML file you downloaded.
Enter an Identity Provider Name for the APM object for the external SAML IdP. For example,
MyTravel_EntraID
- Select Add New Row.
- Select the new SAML IdP Connector.
- Select Update.
- Select OK.
Header SSO configuration
Create an APM SSO object.
Select Access > Profiles/Policies > Per-Request Policies > Create.
Enter a Name.
Add at least one Accepted Language.
Select Finished.
For the new per-request policy, select Edit.
The visual policy editor starts.
Under fallback, select the + symbol.
On the General Purpose tab, select HTTP Headers > Add Item.
Select Add new entry.
Create three HTTP and Header modify entries.
For Header Name, enter upn.
For Header Value, enter %{session.saml.last.identity}.
For Header Name, enter employeeid.
For Header Value, enter %{session.saml.last.attr.name.employeeid}.
For Header Name, enter group_authz.
For Header Value, enter %{session.saml.last.attr.name.
http://schemas.microsoft.com/ws/2008/06/identity/claims/groups
}.
Note
APM session variables in curly brackets are case sensitive. We recommend you define attributes in lowercase.
- Select Save.
- Close the visual policy editor.
Access profile configuration
An access profile binds many APM elements managing access to BIG-IP virtual servers, including access policies, SSO configuration, and UI settings.
Select Access > Profiles / Policies > Access Profiles (Per-Session Policies) > Create.
For Name, enter MyTravel.
For Profile Type, select All.
For Accepted Language, select at least one language.
select Finished.
For the per-session profile you created, select Edit.
The visual policy editor starts.
Under fallback, select the + symbol.
Select Authentication > SAML Auth > Add Item.
For the SAML authentication SP configuration, from the AAA Server dropdown, select the SAML SP object you created.
Select Save.
Attribute mapping
The following instructions are optional. With a LogonID_Mapping configuration, the BIG-IP active sessions list has the signed-in user principal name (UPN), not a session number. Use this data when analyzing logs or troubleshooting.
For the SAML Auth Successful branch, select the + symbol.
In the pop-up, select Assignment > Variable Assign > Add Item.
Enter a Name
In the Variable Assign section, select Add new entry > change. For example, LogonID_Mapping.
For Custom Variable, set session.saml.last.identity.
For Session Variable, set session.logon.last.username.
Select Finished.
SelectSave.
On the Access Policy Successful branch, select the Deny terminal.
Select Allow.
Select Save.
Select Apply Access Policy.
Close the visual policy editor.
Back-end pool configuration
To enable BIG-IP to forward client traffic correctly, create an APM node object representing the back-end server hosting your application. Place the node in an APM pool.
Select Local Traffic > Pools > Pool List > Create.
For a server pool object, enter a Name. For example, MyApps_VMs.
Add a pool member object.
For Node Name, enter a name for the server hosting the back-end web application.
For Address, enter the IP address of the server hosting the application.
For Service Port enter the HTTP/S port the application is listening on.
Select Add.
Note
To learn more go to my.f5.com for K13397: Overview of HTTP health monitor request formatting for the BIG-IP DNS system.
Virtual server configuration
A virtual server is a BIG-IP data plane object represented by a virtual IP address listening for clients requests to the application. Received traffic is processed and evaluated with the APM access profile associated with the virtual server. Traffic is directed according to policy.
Select Local Traffic > Virtual Servers > Virtual Server List > Create.
Enter a virtual server Name.
For Destination Address/Mask, select Host
Enter an unused IP IPv4 or IPv6 to be assigned to the BIG-IP to receive client traffic.
For Service Port, select Port, 443, and HTTPS.
For HTTP Profile (Client), select http.
For SSL Profile (Client), select the client SSL profile you created, or leave the default for testing.
For Source Address Translation, select Auto Map.
For Access Policy, select the Access Profile created earlier. This action binds the Microsoft Entra SAML preauthentication profile and headers SSO policy to the virtual server.
For Per-Request Policy, select SSO_Headers.
- For Default Pool, select the back-end pool objects you created.
- Select Finished.
Session management
Use the BIG-IPs session management setting to define the conditions for user session termination or continuation. Create policy with Access Policy > Access Profiles. Select an application from the list.
Regarding SLO functionality, a SLO URI in Microsoft Entra ID ensures an IdP-initiated sign-out from the MyApps portal terminates the session between the client and the BIG-IP APM. The imported application federation metadata.xml provides the APM with the Microsoft Entra SAML sign-out endpoint, for SP initiated sign-out. Therefore, enable the APM to know when a user signs out.
If there's no BIG-IP web portal, the user can't instruct the APM to sign out. If the user signs out of the application, the BIG-IP is oblivious to the action. The application session can be reinstated through SSO. Therefore, SP-initiated sign out needs careful consideration.
To ensure sessions terminate securely, add an SLO function to your application Sign out button. Enable it to redirect the client to the Microsoft Entra SAML sign-out endpoint. For the SAML sign out endpoint for your tenant, go to App Registrations > Endpoints.
If you can't change the app, enable the BIG-IP to listen for the app sign-out call and trigger SLO. To learn more:
- Go to support.f5.com for K42052145: Configuring automatic session termination (logout) based on a URI-referenced file name
- Go to my.f5.com for K12056: Overview of the Logout URI Include option
Deploy
- Select Deploy to commit settings.
- Verify the application appears in your tenant.
- The application is published and accessible via SHA, with its URL or Microsoft portals.
Test
Perform the following test as a user.
Select the application external URL, or in the MyApps portal select the application icon.
Authenticate to Microsoft Entra ID.
A redirection occurs to the BIG-IP virtual server for the app and signed in with SSO.
The injected header output appears by the header-based application.
For increased security, block direct access to the application, enforcing a path through the BIG-IP.
Troubleshooting
Use the following guidance for troubleshooting.
Log verbosity
BIG-IP logs have information to help isolate authentication and SSO issues. Increase the log verbosity level:
- Go to Access Policy > Overview > Event Logs.
- Select Settings.
- Select the row of your published application.
- Select Edit > Access System Logs.
- From the SSO list, select Debug.
- Select OK.
- Reproduce the issue.
- Review the logs.
- When finished, revert the settings.
BIG-IP error message
If a BIG-IP error appears after redirection, the issue likely relates to SSO from Microsoft Entra ID to the BIG-IP.
- Navigate to Access Policy > Overview.
- Select Access reports.
- Run the report for the last hour.
- Review the logs for clues.
- For your session, select the View session variables link.
- Verify the APM receives the expected claims from Microsoft Entra ID.
No BIG-IP error message
If no BIG-IP error message appears, then the issue is probably more related to SSO from the BIG-IP to the backend application.
- Navigate to Access Policy > Overview.
- Select Active Sessions.
- Select the link for your active session.
- Select the View Variables link to determine any SSO issues.
- Confirm the BIG-IP APM fails or succeeds to obtain the correct user and domain identifiers.
Learn more:
- Go to devcentral.f5.com for APM variable assign examples
- Go to techdocs.f5.com for BIG-IP Access Policy Manager: Visual Policy Editor