SOLVED
Home

Restricting access to Office 365- Microsoft Teams After defined hours

%3CLINGO-SUB%20id%3D%22lingo-sub-819379%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819379%22%20slang%3D%22en-US%22%3EI%20believe%20if%20not%20utilizing%20conditional%20access%20you%E2%80%99re%20only%20option%20is%20using%20adds%20or%20pass-through%20auto%20and%20limit%20the%20login%20hours%20in%20AD!%20Although%20I%20suspect%20this%20isn%E2%80%99t%20waterproof%20since%20if%20they%E2%80%99ve%20logged%20in%20already%20they%20will%20stay%20connected%20til%20that%20token%20expires%3CBR%20%2F%3E%3CBR%20%2F%3EEdit%3A%20for%20Teams%20only%20I%20don%E2%80%99t%20think%20there%E2%80%99s%20any%20controls%20of%20this%20possible%20outside%20of%20using%20CA%20-%20which%20you%20can%20control%20geo%20and%20IP%20ranges%20in%20this%20scenario!%3CBR%20%2F%3EHopefully%20someone%20else%20have%20some%20ideas%20if%20this%20really%20I%3CBR%20%2F%3EIs%20needed%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819409%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819409%22%20slang%3D%22en-US%22%3EThanks%20Adam%20for%20your%20response%2C%3CBR%20%2F%3EHopefully%20we%20can%20able%20to%20analyze%2C%20find%20out%20some%20solutions%20with%20the%20help%20of%20community%20members.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819466%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819466%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20only%20way%20to%20restrict%20logon%20hours%20is%20when%20authentication%20happens%20on-premises%2C%20so%20you%20need%20either%20PTA%20or%20AD%20FS.%20But%20that%20will%20of%20course%20apply%20to%20all%20apps%2C%20not%20just%20Teams.%20An%20alternative%20is%20to%20schedule%20a%20PowerShell%20script%20that%20periodically%20disables%2Freenables%20the%20account%20and%20revokes%20tokens.%20Again%2C%20applies%20to%20all%20apps.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECA%20doesn't%20offer%20time-based%20controls%2C%20but%20it's%20the%20only%20solution%20that%20can%20target%20just%20the%20Teams%20app.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819471%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819471%22%20slang%3D%22en-US%22%3E%3CP%3EVasil%2C%20The%20main%20idea%20is%20to%20block%20login%20on%20teams%20after%20office%20hours.%20so%20suppose%20if%20I%20block%20the%20login%20hours%20from%20AD%20then%20how%20will%20it%20synced%20with%20the%20Teams%20App%20in%20this%20case%20the%20users%20will%20still%20be%20able%20to%20use%20the%20team%20app%20on%20their%20mobile%20phone.%20Please%20suggest%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819475%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819475%22%20slang%3D%22en-US%22%3EBy%20using%20ADFS%20or%20pta%2C%20all%20logins%20go%20to%20your%20AD%20for%20authentication!%20Doesn%E2%80%99t%20matter%20where%20or%20what%20device%20it%E2%80%99s%20from!%3CBR%20%2F%3E%3CBR%20%2F%3EAlthough%20as%20both%20and%20I%20pointed%20out%2C%20this%20will%20block%20logins%20to%20all%20Office%20365%20services%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-820023%22%20slang%3D%22en-US%22%3ERe%3A%20Restricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-820023%22%20slang%3D%22en-US%22%3EEven%20when%20using%20PTA%20or%20ADFS%20you%20will%20have%20tokens%20that%20won't%20expire%20and%20you'll%20stay%20logged%20in%2C%20it'll%20only%20restrict%20someone%20from%20logging%20in%20if%20their%20token%20expires%20and%20they%20need%20to%20re-log%20in%20during%20this%20time%20or%20you%20crank%20your%20token%20expiration%20way%20down%20which%20will%20create%20angry%20users.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819363%22%20slang%3D%22en-US%22%3ERestricting%20access%20to%20Office%20365-%20Microsoft%20Teams%20After%20defined%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819363%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Team%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20everyone%20is%20doing%20well.%20I%20had%20one%20questions%20for%20this%20wonderful%20community%2C%20Hope%20I%20will%20get%20more%20inputs%20from%20all%20of%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe're%20looking%20to%20restrict%20login%20hours%20for%20a%20person%20in%20Microsoft%20Teams%2C%20Don't%20want%20to%20allow%20him%20to%20access%20Teams%20after%20working%20hours%20or%20defined%20time%20period.%20Currently%20we%20don't%20want%20to%20use%20conditional%20access%20to%20allow%20use%20of%20only%20office%20network%20and%20block%20all%20external%20access.%20As%20Users%20need%20to%20be%20connect%20through%20different%20networks%20for%20work%20access.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20provide%20me%20your%20inputs%20to%20achieve%20this%2C%20Any%20help%20would%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EJitesh%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-819363%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECommunity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESettings%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Jitesh_Kumar
New Contributor

Hello Team,

 

Hope everyone is doing well. I had one questions for this wonderful community, Hope I will get more inputs from all of you.

 

We're looking to restrict login hours for a person in Microsoft Teams, Don't want to allow him to access Teams after working hours or defined time period. Currently we don't want to use conditional access to allow use of only office network and block all external access. As Users need to be connect through different networks for work access.

 

Please provide me your inputs to achieve this, Any help would be greatly appreciated:smile:.

 

Thanks,

Jitesh

6 Replies
I believe if not utilizing conditional access you’re only option is using adds or pass-through auto and limit the login hours in AD! Although I suspect this isn’t waterproof since if they’ve logged in already they will stay connected til that token expires

Edit: for Teams only I don’t think there’s any controls of this possible outside of using CA - which you can control geo and IP ranges in this scenario!
Hopefully someone else have some ideas if this really I
Is needed
Thanks Adam for your response,
Hopefully we can able to analyze, find out some solutions with the help of community members.
Solution

The only way to restrict logon hours is when authentication happens on-premises, so you need either PTA or AD FS. But that will of course apply to all apps, not just Teams. An alternative is to schedule a PowerShell script that periodically disables/reenables the account and revokes tokens. Again, applies to all apps.

 

CA doesn't offer time-based controls, but it's the only solution that can target just the Teams app.

Vasil, The main idea is to block login on teams after office hours. so suppose if I block the login hours from AD then how will it synced with the Teams App in this case the users will still be able to use the team app on their mobile phone. Please suggest

By using ADFS or pta, all logins go to your AD for authentication! Doesn’t matter where or what device it’s from!

Although as both @Vasil Michev and I pointed out, this will block logins to all Office 365 services
Even when using PTA or ADFS you will have tokens that won't expire and you'll stay logged in, it'll only restrict someone from logging in if their token expires and they need to re-log in during this time or you crank your token expiration way down which will create angry users.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies