Merging tenancies in web & teams app
I'm working on a Microsoft Teams version of our web app and looking for some guidance on the situation below. The app is used by larger companies (250+ employees) to do work in virtual teams within the app, and share information across teams within the same company.
When a company registers on our WEB version, we create a Company ID so that all of their employees can be linked together and use paid features where users share the same Company ID.
Microsoft Teams provides a Tenancy ID which is effectively the same concept as our Company ID. To make the process more streamlined for users, when a user signs in from MS Teams the Tenancy ID replaces our Company ID and we can group users together by their shared tenancy, and that saves their IT team from manually managing their users in our app.
The problem is in larger companies there can be multiple departments that found the app on the web and started using it without any knowledge of each other. Each department is assigned a Company ID and has a custom configuration. They will get merged together if they all start using the Microsoft Teams app because they'll have a common Tenancy ID. Ultimately this means we only keep the configuration settings for one of the Company IDs, leading to confusion, support calls etc.
This is an edge case, we haven't encountered it in the wild and doubt we ever will...but it is a scenario that came up in Microsoft Testing because they use multiple tenancies and shared accounts for their testing.
Is there any elegant way to handle this? Is there a better way to group employees on the web (email domain for example) so we can identify if a company is already using our product when someone registers?