Two-Factor Authentication (2FA/MFA) for Exchange Outlook Web Access (OWA)
Microsoft Office Outlook Web Access (OWA) offers integrated time and information management solutions. E-mail, calendar management, task management, contact management, note-taking, journaling, and online surfing are just a few of the capabilities of Outlook that help with communication and organizing. Outlook helps you to search and categorize your mail, organize your work, and better share your information with others all from one handy spot. You can enable two-factor authentication for Outlook Web Access (2FA/MFA for OWA) managed active directory to increase the security level.
Two-Factor Authentication (2FA) or Multi-factor Authentication (MFA) is the process of authentication in which you have to provide two factors to gain access into a particular application. First Factor is the one that you know - username and password and Second factor is - what you might have as unique, like a phone (For OTP) or Fingerprint. When we integrate 2FA in OWA, this additional layer of security prevents the unauthorized person from accessing your Microsoft OWA Applications even if they know your username and password. miniOrange provides 15+ Multi-factor Authentication methods and solutions to secure your resources.
Connect with External Source of Users
miniOrange provides user authentication from various external sources, which can be Directories (like ADFS, Microsoft Active Directory, Azure AD, OpenLDAP, Google, AWS Cognito etc), Identity Providers (like Shibboleth, Ping, Okta, OneLogin, KeyCloak), Databases (like MySQL, Maria DB, PostgreSQL) and many more.
miniOrange
Authenticator App
Google
Authenticator App
Authy 2-Factor
Authentication App
Microsoft
Authenticator App
Follow the Step-by-Step Guide given below to enable Two-Factor Authentication (2FA) for outlook-web-access
1. Configure Exchange Gateway in miniOrange IdP
- Login into miniOrange dashboard from the Admin Console.
- From the left side menu, click on Apps → Manage Apps.

- Click on Add Applicaton button.

- In choose application type, click on create app button in SAML/WS-FED application type.

- In the next step, search for your application from the list, if your application is not found. Search for "custom" and you can set up your app via Custom SAML App.

- Configure Basic Settings for App:
- Custom Application Name: App name you like to provide. E.g. Custom SAML App.
- SP Entity ID or Issuer: Enter SP Entity ID / Issuer that would uniquely identify the Exchange Gateway.
Note that the same value would need to be configured in the Exchange Gateway in the next steps.
https://myhost/exchangegateway/
- ACS URL: Enter ACS (Assertion Consumer Service) URL in the following format:
https://myhost/exchangegateway/login.php, where https://myhost is the hostname of the server hosting the Exchange Gateway.

- Configure Attribute Mapping:
- Select the attribute name with which you want to log in your application in Name ID field from the dropdown.
eg. Username, Email, etc.
- Enter Name ID format such as E-mail address, nameid, etc in Name ID Format.
- Attributes can be mapped using the Add Attribute tab.
- Add attributes such as Email, Full name, etc. with its corresponding value as per shown in image.
- Multiple attributes can be added using icons.

- Create an appropriate policy for the SAML Application.
- Group Name : Select an appropriate Group Name from the dropdown.
- Policy Name: Policy name you like to provide.
- Login Method: Select Appropriate method from the dropdown.

- Click on Save.
- To upload respective app logo for a Custom SAML App, click on Upload Logo tab.

- Click on Save.
2. Configure miniOrange Exchange Gateway
Pre-requisites:
- PHP >=5.4: Official PHP installation guide
- PHP LDAP Extension: Quick miniOrange guide to enable php-ldap extension
- OpenSSL libraries
- PHP DOM extension
- Setup miniOrange Exchange Gateway
- Download Exchange Gateway. It can be deployed on any web server(Apache/IIS) on any
OS.
- Extract the zip file in the web applications directory (/var/www/html for
Linux or c:\inetpub\wwwroot IIS on WIndows servers)
Configure AD/LDAP Connection for Exchange Gateway (LdapUtils.php) :
- Configure server_name, ldap_bind_dn, ldap_bind_password, search_filter, search_base attributes.

Configure miniOrange as IdP for the Exchange Gateway (SamlConstants.php) :
- From the SAML app created in the 1st step, go to metadata details.

- Choose ‘Information required to authenticate VIA External IDPS’.
- Update SAML Login URL, SAML Logout URL, X.509 Certificate, IdP Entity ID or Issuer in SamlConstants.php file from the above metadata details.

Configure Exchange/OWA as application on Exchange Gateway (WsFedConstants.php)
Configure OWA/ECP base URL here.
Outlook URL: https://Exchange Base URL/owa
E.g.:https://mail.miniorange.com/owa
Exchange Control Panel URL: https://Exchange Base URL/ecp
E.g.:https://mail.miniorange.com/ecp

3. Configure Exchange / OWA for Sign-On using miniOrange and Exchange Gateway
- Add Signing certificate (obtained in above step) to the Trusted People store
on the Client Access Server using the steps below:
- Open WsFedConstants.php copy the public key certificate into a new file
and name it exchange-gateway.crt
- Got to Management Console. Open run dialog (Win + R) and type mmc and press enter.
- In Management Console, go to File > Add or Remove Snap-ins (Ctrl + M).
- Search for Certificates on the left side and press Add.
- In the Certificate Snap In window, select Computer account and press Next. Then select Local Computer and press Finish.
- You will see an entry for Certificates (Local Computer) in the right pane. Click OK to close the Add or Remove Snap-ins window.
- You will see a branch named Certificates created under Console Root. Expand the Certificates branch and select Trusted People.
- Right click on Trusted People > Find > Import and click on Next.
- Choose the location of the exchange-gateway.crt file you created above and click on Next, again Next and Finish.
- You have successfully added a Signing Certificate to Trusted People. Now close
Management Console and choose No on the Save data prompt.
- Execute the commands on the Client Access Server using the Exchange Management
Shell.
$uris=@("https://##Base URL##/owa/","https:///##Base URL##/ecp/","https:///##Base
URL##/owa","##Base URL##/ecp")
- In the above command, ##Base URL## is the exchange/OWA host. The command has both URLs: One
ending in / and the other one which does not contain a trailing slash.
Set-OrganizationConfig -AdfsIssuer "https://##Exchange Gateway
Host##/exchangegateway/login.php" -AdfsAudienceUris $uris -AdfsSignCertificateThumbprint
##Cert Thumbprint##
- In the above command, ##Exchange Gateway URL## is the host name of the Exchange
Gateway. The Cert Thumbprint is the SHA-1 thumbprint of the certificate you created
above (exchange-gateway.crt) in the Exchange Gateway (in the includes
directory).
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory -AdfsAuthentication $true
-BasicAuthentication $false -DigestAuthentication $false -FormsAuthentication $false
-WindowsAuthentication $false
Get-OwaVirtualDirectory | Set-OwaVirtualDirectory -AdfsAuthentication $true
-BasicAuthentication $false -DigestAuthentication $false -FormsAuthentication $false
-WindowsAuthentication $false -OAuthAuthentication $false
# Restart w3svc and was
net stop was /y
net start w3svc
4. Configure 2FA for Outlook Web Access (OWA)
4.1: Enable 2FA for Users of Outlook Web Access (OWA) app
- To enable 2FA for Users of Outlook Web Access (OWA) application. Go to Policies >> App Authentication Policy
- Click on Edit against the configured application.

- Enable the Enable 2-Factor Authentication (MFA) option.

- Click on Save.
4.2: Configure 2FA for your Endusers
- To enable 2FA/MFA for endusers, go to 2-Factor Authentication >> 2FA Options For EndUsers.
- Select default Two-Factor authentication method for end users. Also, you can select particular 2FA methods, which you want to show on the end users dashboard.
- Once Done with the settings, click on Save to configure your 2FA settings.

4.3: Enduser 2FA Setup
- Login to End-User Dashboard using end user login URL.
- For Cloud Version: The login URL (branding url) which you have set.
- For On-Premise version: The login URL will be the same as of Admin Login URL.
- Select Setup 2FA from left panel. Then select any of the 2FA method available.
- For now, we have selected the SMS >> OTP OVER SMS as our 2FA method. You can explore the guide to setup other 2FA methods here.
- Enable the OTP over SMS if you have your phone number added under your profile section else click on Edit button.

- Enter you Phone Number along with the necessary country code and click on the SAVE button.

5. Test Outlook Web Access (OWA) 2FA
6. Adaptive Authentication with Outlook Web Access (OWA)
A. Restricting access to Outlook Web Access (OWA) with IP Blocking
B. Adaptive Authentication with Limiting number of devices.
Using Adaptive Authentication you can also restrict the number of devices the end user can access the Services on. You can allow end users to access services on a fixed no. of devices. The end users will be able to access services provided by us on this fixed no. of devices.
You can configure Adaptive Authentication with Device Restriction in following way
- Login to Self Service Console >> Adaptive Authentication.
- Add a Policy Name for your Adaptive Authentication Policy.
- Select your Action for behaviour Change and Challenge Type for user from the Action for behaviour Change Section.

- Scroll down to Device Configuration section and enable Allow User to Register Device option to allow users to register their devices.
- Enter the Number of Devices which are allowed to register in field next to Number of Device Registrations Allowed
- Choose Action if number of devices exceeded (This will override your setting for Action for Behaviour Change.)
- Challenge: The user needs to verify himself using any of the three methods mentioned in table in step 6.1
- Deny : Deny users access to the system
- Enable option Send email alerts to Users if number of Device registrations exceeded allowed count if you want to alert the user about no of devices exceeding the limit. Save the configuration.

C. Add Adaptive Authentication policy to Outlook Web Access (OWA).
- Login to Self Service Console >> Policies.
- Click on Edit option for predefined SAML app policy.

- Set your application name in the Application and select password as Login Method.
- Enable Adaptive Authentication on Policy page and select the required restriction method as an option.
- From Select Login Policy dropdown select the policy we created in last step and click on save.

How to add a trusted Device
- When End-user log in to the self service console after the policy for device restriction is on, he is provided the option to add the current device as a trusted device.
External References