OfficeDev / Microsoft-Teams-Samples

Welcome to the Microsoft Teams samples repository. Here you will find task-focused samples in C#, JavaScript and TypeScript to help you get started with the Microsoft Teams App!
MIT License
1.03k stars 784 forks source link

Error: botAadApp/create failed due to service management reference #1441

Closed yuting1008 closed 1 week ago

yuting1008 commented 2 weeks ago

I am reproducing https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/msgext-expert-finder-js. When setting up resources, I fail to run the app in a Teams web client.

(×) Error: botAadApp/create failed. (×) Error: Service management reference is required when creating Microsoft Entra app in Microsoft tenant. Please refer to the help link to provide a valid service management reference. (!) Warning: botFramework/create was not executed. (!) Warning: teamsApp/validateManifest was not executed. (!) Warning: teamsApp/zipAppPackage was not executed. (!) Warning: teamsApp/validateAppPackage was not executed. (!) Warning: teamsApp/update was not executed. (!) Warning: teamsApp/extendToM365 was not executed.

Below is the botAadApp/create.

  # Create or reuse an existing Azure Active Directory application for bot.
  - uses: botAadApp/create
    with:
      # The Azure Active Directory application's display name
      name: expert-finder-${{TEAMSFX_ENV}}
    writeToEnvironmentFile:
      # The Azure Active Directory application's client id created for bot.
      botId: BOT_ID
      # The Azure Active Directory application's client secret created for bot.
      botPassword: SECRET_BOT_PASSWORD

How to fix this issue? Thank you!

sayali-MSFT commented 2 weeks ago

@yuting1008 - Thank you for your inquiry about your Teams app development issue! We will check this at our end and will get back to you.

yuting1008 commented 2 weeks ago

I try to follow Case 2 solultion in the help link that the error message provides.

image

This is what I have done:

  1. Update teamsapp.yml and teamsapp.local.yml files to use aadApp/create action
  2. Add BOT_OBJECT_ID to env/.env.{name} after updated the yaml file
  3. (I am not sure what "provide service tree ID" means in the instruction.)

But it doesn't work. The error message is as below.

(×) Error: aadApp/create failed. (×) Error: Service management reference is required when creating Microsoft Entra app in Microsoft tenant. Please refer to the help link to provide a valid service management reference.

sayali-MSFT commented 2 weeks ago

Hello @yuting1008 - We are currently unable to reproduce the issue you’re experiencing.

Could you kindly recheck and follow the steps outlined in the README file? Additionally, may I ask you to try using the manifest provided below? expert-finder.zip

image

yuting1008 commented 2 weeks ago

Hi @sayali-MSFT

I tried the manifest you provided and the sample prompt in README but it still didn't work. in Copilot for Microsoft 365

Image Description

in Chat It said "Couldn't connect to the App. Please try again."

image

I also rechecked and followed the steps outlined in the README file. Below is the complete error message when I run the app in Teams web client. image

yuting1008 commented 2 weeks ago

I seem to solve the botAadApp/create problem by creating App Registration and providing BOT_ID and SECRET_BOT_PASSWORD manually.

What I have done:

  1. Create App Registration and generate a secret 螢幕擷取畫面 2024-11-11 232155

  2. Add BOT_ID to env.local

    螢幕擷取畫面 2024-11-11 232325
  3. Add SECRET_BOT_PASSWORD to env.local.user

螢幕擷取畫面 2024-11-11 232512

After running the app in Teams web client, I am now facing the other issue. According to the README, Azure bot will be created automatically in the selected subscription and resource group while running the sample using Toolkit.

image

However, the Azure Bot Service wasn't create automatically in my resource group. The Bot was created in dev.framework.com instead.

螢幕擷取畫面 2024-11-11 233643

And the APP was still unable to connect.

image

sayali-MSFT commented 1 week ago

Hello @yuting1008, Glad to hear that your posted issue is resolved! We are currently unable to reproduce the issue you’re experiencing.

it seems that the bot is being created in a different resource group (dev.framework.com) instead of the one you selected. This issue might be related to the configuration settings or the way the bot service is being deployed.

Ensure that the configuration settings in your project are correctly pointing to the desired subscription and resource group. Double-check the env.local file or any other configuration files for any discrepancies. Also, Check the deployment logs for any errors or warnings that might indicate why the bot service wasn't created in the expected resource group. This can provide clues about what went wrong during the deployment process.

microsoft-github-policy-service[bot] commented 1 week ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 3 days of this comment.

microsoft-github-policy-service[bot] commented 1 week ago

Tell us about your experience!

Hi @yuting1008! This issue is closed in our system. We would like your feedback on your experience with our support team and Platform.

Best regards, Teams Platform