microsoft-teamsteams-toolkitmicrosoft-teams-jsazure-custom-domain

Adding custom domain to tabs and make it work as multi-tenant


Objective: Make the Tab multi-tenant. Scenario: There is a bot and we added a static tab as a feature. Add a feature was available in the Teams toolkit version 4.x.x. The tab is working fine after deploying to the organization. As the next step in our progress, we submitted our app for testing to the Microsoft team and came to know that our tab is not rendering in other organizations. In our own organization, there is no error but in case of using the app in another org, we are unable to get the token to connect to graph API and azure. Snap shot of token error

**error_description **: "AADSTS500011: The resource principal named api://xxxxxxxxx6tab.z13.web.core.windows.net/botid-4xxxxxxx-1xxx-xxxx-xxxx-xxxxxxxxxxxx was not found in the tenant named 4z8g2m. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.\r\nTrace ID: xxxxxxx5-xxx4-xxx9-xxxc-xxxxxxxxxx0\r\nCorrelation ID: xxxxxxxxce-xxx3-xxx8-xxx5-xxxxxxxxxxxxx3\r\nTimestamp: 2023-05-30 01:45:04Z" error_uri : "https://login.microsoftonline.com/error?code=500011" timestamp : "2023-05-30 01:45:04Z" trace_id : "xxxxxxx5-xxx4-xxx9-xxxc-xxxxxxxxxx0" On exploring more details we came to know that our Azure AppName-add that got generated during the deployment was single-tenant. To make the app accessible in multiple org we need to make the app Multi-Tenant. For this, we had to change our app's supported account type. Aad option for tenant type

**Blockers **: To change this we have to use a custom domain as it does not allow to update the account type on an unverified domain. This domain and uri was auto-generated during deployment so we don't have direct access to it. Error while updating to multi-tenant

If we check the documentation and other associated blogs it says we will get Custom domain option in list but we dont have any. Check above screenshot for the same.

Issue : When we added custom domain it also didn't worked and our custom domain threw error. enter image description here Still our app is not multi-tenant. When we open the generated static tab url it opens our web app with the error. We handled such error with error screen. enter image description here

Please comment back if more details are needed.

Followed Resources to fix :

Current status of issue (Addition of custom Domain and make the app multi-tenant ): Not worked Possible issues

Similar Questions Associated with problem & errors :

None of the above listed methods are working


Solution

  • You can follow the instruction here.

    1. Note your frontend domain with key domain under fx-resource-frontend-hosting in .fx/states/state.{env}.json
    2. Point your Custom Domain to the above domain
    3. Update frontend info in templates\azure\provision\azureStorageTab.bicep
    4. Open .fx/configs/azure.parameter.${env}.json and set value of m365TenantId to "common"
    5. Provision and deploy again

    And your Teams app should be config as multi-tenant.