Does the resource URL in webApplicationInfo need to contain the Microsoft Teams App ID?

Viewed 58

My teams app uses a bot and is configured for SSO, the webApplicationInfo property in my manifest looks something like this following this documentation:

"webApplicationInfo": {
    "id": "{Azure AD AppId}",
    "resource": "api://{Subdomain}.example.com/botid-{Azure AD AppId}"
    }

The resource URL is ultimately used as the Application ID URI and Redirect URI in my bot's app registration and then is also used as the Token Exchange URL in my bot's connection.

The current set up works well, but I want to automate the creation of the bot in Azure using Terraform or Pulumi. However, because the resource URL in webApplicationInfo is structured to include the App ID, the creation process for the app registration has a self-referential problem: the Application ID URI and Redirect URI can't be configured during creation because the App ID isn't available until after the app registration is created.

What purpose does including the App ID in the resource URL serve? Is it essential for me to include? Will I run into issues down the road? Excluding it from the URL would solve these self-referential problems.

1 Answers

First off, you have an error in your code sample: it's not botid-{Azure AD AppId}, but rather just {Azure AD AppId}. That means it's the same AppId as the line above. A complete example would look something like this (with a sample app id):

"webApplicationInfo": {
    "id": "3bbd1472-40d9-4852-bee6-33e16739a7b7",
    "resource": "api://myApi.example.com/3bbd1472-40d9-4852-bee6-33e16739a7b7"
    }

That aside, you definitely need to have this id, but the sequence for Terraform /Pullumi should be ok. It should be:

  1. Create Azure App, get it's Id
  2. Create Bot (you can specify the Azure App Id you created above, as being the App Id to use)
  3. Create the Teams manifest using the Azure App Id
Related