Microsoft Authentication Library (MSAL library) example in windows forms on .NET 4.6.1
Here is a utility for your implementation of applications that are restricted from accessing the microsoft account, especially if your company consumes Azure services such as (Cosmos DB) ...
You can configure access restriction by user or by group through the appinfo.json file