Calendaring in Teams & Exchange (on-prem)Ralf [email protected] 15.4 – 21st May 2013

AgendaArchitecture and requirementsAutodiscover v2Teams Calendar AppMeeting planning for DelegatesPresence status based on calendar items

Where Teams and Exchange discover v2PresenceStatusAuto-Update

Architecture302 HTTPOn On-PremAutodiscoverExchange Web Services / REST

Requirements Teams interact with Exchange on-prem Exchange 2016 or higher (2013 for the Delegate scenario) on latest CU AAD-Connect to sync identities Teams licenses assigned oAuth to be configured between on-prem and Azure/M365 Using the Exchange HCW is preferred, manual steps documented (Classic Hybrid!!!) Exchange EWS/REST API and Autodiscover published EWS namespace to be configured as SPN in AAD (Outlook MAC only) Fully configured Partner Application (Delegate scenario ith-online-and-on-premises

KnowledgeCheck title styleClickto edit MasterHow many daily active users do we have in Teams (Oct.2020?

Teams Autodiscover Autodiscover to retrieve EWS and RESTAPI locations Teams uses Autodicover v2 JSON(anonymous) Is done by Teams Backend Process:1.2.a)b)3.4.5.Teams sends JSON to Exchange OnlineExchange Online checks the recipient typeIf it’s a mailbox, asmx (Done!)It it’s mail user, calculate a DNS Autodiscover endpoint (basedon ExternalEmailAddress) - i.e. autodiscover.contoso.comSend HTTP 302 redirect including the endpointTeams sends JSON to the on-prem endpointExchange on-prem returns EWS/REST URL

Troubleshoot Autodiscover I Don’t trace the Teams client AutodiscoverV2 is anonymous - you can test yourself Use the PowerShell or Browser and a customer E-Mail-Address:PS C:\ Invoke-RestMethod autodiscover.json?Email [email protected]&Protocol EWS”In the /autodiscover.json?Email [email protected]&Protocol discover.json?Email [email protected]&Protocol REST Collect a fiddler trace while testing A failure (esp. a timeout) doesn’t indicate a problem - restricted access to O365 IP-Ranges? Check the Autodiscover Logs to verify the request reaches the server Check the IIS logs for Teams requests Collect a network trace and check for Teams request, i.e. TLS handshake errors etc.

Exchange Logging (i.e. EWS)\Web Service(DefaultWeb Site)\CurrentConnectionsIIS\Web Service(ExchangeBack End)\CurrentConnections\EWS / HTTP ProxyBearer Authenticationand Mailbox anchoringhappens hereEWS Proxy\EWSBackEndAll application action happens hereEWSIISPort 443Port 444EWShttps.sysu W3SVC1Teams XXXXX-X.loghttps.sysu W3SVC2Logging\HTTPProxy\EWSCAFE ComponentMSExchangeServicesAppPool(W3WP)EWS XXXXXXXX-X.logLogging\EWS\Mailbox Component

Troubleshoot Autodiscover IIAutodiscover returns unexpected EWS/REST URLs:a)The user’s mailbox is on-prem but you nge.asmx”This can happen if for the user exists a duplicate mailbox in Exchange Online.b) Something that looks like an “internal” asmx”The EWS “ExternalUrl” attribute is not populated on ALL Exchange servers.c)The user’s mailbox is hosted on an EMEA Server, but you receive an APAC or NAM belonging namespace.AutodiscoverV2 is NOT site aware (as of today). We’re working into that

The Teams Calendar App Teams uses Exchange Web Services to retrieve calendar data Reminder: the Teams client does NOT connect to ExchangeHow the process works: EWS URL is received by AutodiscoverTeams authenticates using oAuth on Exchange on-premIt sends EWS requests to Exchange Web ServicesExchange sends back the calendar dataTeams Middle-Tier populates the App using the data

Troubleshooting Calendar App issues Verity if the URL has is in public DNS and reachable from external Start fiddler and paste the URL into a browser to get 401 (again: timeout doesn’t indicate aproblem), check is the returned data origins from Exchange Try the Remote Connectivity Analyzer,new Teams test since this week! Verify that oAuth works correctly Test-OAuthConnectivity Check IOC, SPNs, AuthServers Try the Team Connectivity Analyzer eams

KnowledgeCheck title styleClickto edit MasterHow many times did users run the Teams ConnectivityAnalyzer scenario since it launched in Dec 2020?

The EWS Allow- and BlockList Myth Covered in all UC Wiki and public articles By default, there’s no limits Avoid sending action plans to configuresomething else as the defaults 99% of all customer don’t use the lists There’s more cases where “user agents” arefiltered outside of Exchange Maintaining the EWS Lists is not a security featureUser Agent List:Calendar: MicrosoftNinja/1.0 Teams/1.0 (ExchangeServicesClient/ SkypeSpaces/1.0a * Delegate: SchedulingServicePresence: Microsoft.Skype.Presence.App/1.0

The Teams Delegate Meeting scenario Teams uses Exchange Web Services to retrieve a list of delegates andtheir permissions Limited to the Outlook Team Add-in, not supported in OWA on-prem Delegates need to be setup using the Outlook Delegation wizardHow the process works: hits the “Teams Meeting” button in Outlook in manager’s calendarThe Add-in connects to Teams Middle-tierIt does an Autodiscover to receive the EWS URLTeams connects to /EWS and authenticates using oAuth on Exchange on-premIt sends EWS a GetDelegate SOAP request for the “manager’s” mailboxExchange sends back the delegate list including their folder permissionsTeams Middle-Tier provides the meeting data to the Add-in

Troubleshooting Delegate issues Verify if the Teams calendar app works correctly Use SOAPe client to manually send a GetDelegate and check the answerClientside fiddler you’ll get "StatusCode": 403Adding calendar permissions is not sufficientCheck EWS logs for the GetDelegate call? Is it a 200?Check PartnerApp configurationCheck EWS Proxy and IIS FrontEnd logsCollect a network traceEliminate (3rd party) layer 7 devices(user agent filtering)

KnowledgeCheck title styleClickto edit MasterGues the number of hits for the “How Exchange andMicrosoft Teams interact“ doc page in February 2021 ams/exchange-teams-interact

The Presence Status based on calendar Users want status to be “In a Meeting” automatically Teams BackEnd uses REST API vDir to retrieve the data from Exchange Yes really, same data that is already in the Calendar app The clients pulls data every 6min from the Presence service Two modes:1.2.Pull mode, once per hourPush mode based on subscription Limited functionality in on-prem, Pull mode only. Subscription not available inExchange on-prem. Delegates need to be setup using the Outlook Delegation wizardHow the process works: MT does an Autodiscover to receive the REST API URLTeams connects to /api and authenticates using oAuth on Exchange on-premIt trys to create a subscription - fails RPC endpoint not foundIt sends a get calendar request

Troubleshooting Presence Status issues Verify if the /api is returned by Autodiscover and is accessible/published,maybe use Fiddler Update the REST CAFE web.config (fixed in Exchange Dec. 2020 CUs)C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\Rest\web.config from: httpRuntime maxRequestLength "2097151" maxUrlLength "2048" requestPathInvalidCharacters "<, ,*,%,\,?" requestValidationMode "2.0" / to: httpRuntime maxRequestLength "2097151" maxUrlLength "2048" maxQueryStringLength "4096" requestPathInvalidCharacters "<, ,*,%,\,?"requestValidationMode "2.0" / Start looking to the REST logs, againfilter by user agent string Check REST Proxy and IIS FrontEnd logs Eliminate (3rd party) layer 7 devices(user agent filtering)

2021 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on thepart of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.20