Hi João,
Restricting access to Microsoft 365 based on specific time frames is a common request, but it’s not directly supported by Azure AD or Office 365. Here are some potential workarounds:
Conditional Access Policies: You can use Azure Active Directory’s Conditional Access policies to control access based on various conditions. However, these policies do not currently support time-based restrictions.
On-Premises Authentication: If you’re using on-premises authentication (like Pass-through Authentication or AD FS), you could potentially set logon hours in your on-premises Active Directory. However, this would apply to all apps, not just Microsoft 365.
PowerShell Script: Another option is to use a PowerShell script that periodically enables and disables user accounts and revokes tokens. This would also apply to all apps.
Block Sign-In Option: You can leverage the Block Sign-In option if you want to block the user from accessing Azure AD.