Build your first app using Blazor

 Article Developer (Beginner) 9 minutes to complete 5 contributors

Prerequisites

  • 8 minutes remaining

Prepare development environment

Install Microsoft Teams Toolkit

  1. Download the latest version of the Visual Studio.
  2. Open vs_enterprise__3bed52501a604464b1eff2ce580fd4eb.exe from your download folder.
  3. Select Continue in the Visual Studio Installer page to configure your installation.
  1. Select ASP.NET and web development under workloads.
  2. Select Microsoft Teams development tools.
  3. Select Install.

Set up your Teams development tenant

Enable sideloading option

  1. In the Teams client, select Store icon.
  2. Select Manage your apps.
  3. Look for the option to Upload a custom app. If you see the option, sideloading apps is enabled.
  1. Note If Teams doesn’t show the option to upload a custom app, connect to your Teams administrator.

Create a free Teams developer tenant (optional)

  1. Go to the Microsoft 365 developer program.
  2. Select Join Now and follow the onscreen instructions.
  3. In the welcome screen, select Set up E5 subscription.
  4. Set up your administrator account. After you finish, the following screen appears.
  1. Sign in to Teams using the administrator account you just set up. Verify that you have the Upload a custom app option in Teams.

Get a free Azure account

Create project workspace for your tab app

  • 7 minutes remaining
  1. How to set up a new tab project with Teams Toolkit
  2. About the directory structure of your app

Create your tab project

  1. Creating a new project page: You select the project type.
  2. Configure your new project page: You enter the project details.
  3. Create a new Teams application page: You select the Teams app capabilities.
  1. Open the latest version of Visual Studio.
  2. Select Create a new project.
  1. The Create a new project page appears.
  2. Select the project details.
  3. Select the project type:
  4. Select Microsoft Teams from All platforms dropdown list.
  5. Select Microsoft Teams App as the template.
  6. Select Next.
  1. The Configure your new project page appears.
  2. Configure the new project details.
  3. Select the following project configuration:
  4. Enter a suitable name for your project.
  1. Select the folder path where you want to create the project workspace.
  2. Enter a different solution name, if you want.
  3. Check the option to save the project and solution in the same folder, if you want. For this tutorial, you don’t need this option.
  4. Select Create.
  1. The Create a new Teams application page appears.
  2. Select Teams app feature.
  3. Select app feature:
  4. Select the Tab app as the capability for your app.
  5. Select Create.
  1. Your Teams tab app is created in a few seconds.

Take a tour of the source code for Teams tab app

Build and run your first Teams tab app

  • 6 minutes remaining
  1. Select Project > Teams Toolkit > Configure Your Microsoft Teams.
  1. Select your Microsoft 365 account or Add an account to sign in.
  1. Select Debug > Start Debugging or select F5 to run your app in debug mode.
  2. Learn what happens when you run your app locally in the debugger.
  1. Install the self-signed SSL certificate for local debugging, if requested.
  1. Teams is loaded in a web browser.
  2. Select Add when prompted to install the app to Teams.
  1. Congratulations, your first tab app is running in your local environment!
  1. Move through the page to view the user details.
  1. Select Authorize to let your app retrieve user details using Microsoft Graph.
  2. The app requests permission to grant access for displaying user details.
  1. Select Accept to let your app access user details.
  2. Your photograph and details appear in your Personal Tab.
  1. You can do normal debugging activities, such as setting breakpoints, as if it were any other web application. The app supports hot reloading. If you change any file within the project, the page will be reloaded.

Preview your first Teams tab app

  • 5 minutes remaining
  1. Provision your tab app in the cloud: You can provision your tab app in the cloud.
  2. Deploy your tab app to cloud: You can deploy your tab app to cloud.
  3. Preview your tab app in Teams: Your tab app opens in Teams.

To provision your tab app in the cloud

  1. Select Project > Teams Toolkit > Provision in the Cloud.?
  1. Enter the following in the Provision dialog:
  2. Subscription name: Visual Studio Enterprise Subscription.
  3. Resource group: Select New to add the resource group generated for your app.
  4. Select your Region.
  5. Select Provision.
  1. Provision warning displays.
  2. Select Provision.
  1. It takes a few minutes for your resource group to provision in the cloud.
  2. After the provision is complete, select OK.
  1. Select View Provisioned Resources to view on Azure portal.
  1. Sign in to your Azure portal account on sign in prompt.
  2. Your app-dev-rg appears.
  1. Your resources are provisioned in the Azure portal!

To deploy your tab app to cloud

  1. Select Project > Teams Toolkit > Deploy to the Cloud.
  1. Select OK.
  1. Your tab app is successfully deployed to the cloud!

To preview your tab app in Teams

  1. Select Project > Teams Toolkit > Preview Teams app.
  1. Select Add when prompted to install the app to Teams.
  1. Congratulations, your first tab app is running in your Azure environment!
  1. Move through the page to view the user details.
  1. Select Authorize to let your app retrieve user details using Microsoft Graph.
  2. The app requests permission to grant access for displaying user details.
  1. Select Accept to let your app access user details.
  2. Your photograph and details appear in your Personal Tab.

Create project workspace for your bot app

  • 4 minutes remaining
  1. How to set up a new bot project with Teams Toolkit
  2. About the directory structure of your app

Create your bot project

  1. Creating a new project page: You select the project type.
  2. Configure your new project page: You enter the project details.
  3. Create a new Teams application page: You select the Teams app capabilities.
  1. Open the latest version of Visual Studio.
  2. Select Create a new project.
  1. The Create a new project page appears.
  2. Select the project details.
  1. The Configure your new project page appears.
  2. Configure the new project details.
  3. Select the following project configuration:
  4. Enter a suitable name for your project.
  1. Select the folder path where you want to create the project workspace.
  2. Enter a different solution name, if you want.
  3. Check the option to save the project and solution in the same folder, if you want. For this tutorial, you don’t need this option.
  4. Select Create.
  1. The Create a new Teams application page appears.
  2. Select Teams app feature.
  3. Select app feature:
  4. Select the Bot app as the capability for your app.
  5. Select Create.
  1. Your Teams bot app is created in a few seconds.

Take a tour of the source code for Teams bot app

Build and run your first bot app

  • 3 minutes remaining
  1. Select Project > Teams Toolkit > Configure Your Microsoft Teams.
  1. Select your Microsoft 365 account or Add an account to sign in.
  1. Use ngrok or Command prompt to create a tunnel to your locally running web server’s publicly available HTTPS endpoints. Run the following command in ngrok:
  2. Bash Copy
  • ngrok http -host-header=localhost 2544
  1. Select Debug > Start Debugging or select F5 to run your app in debug mode.
  2. Learn what happens when you run your app locally in the debugger.
  3. When you select F5, Teams Toolkit:
  4. Registers your application with Azure Active Directory.
  5. Registers your application for “sideloading” in Teams.
  6. Starts your application backend running locally.
  7. Starts your application front-end hosted locally.
  8. Starts Teams in a web browser with a command to instruct Teams to side load the application (the URL is registered inside the application manifest).
  1. Your web browser starts to run the app.
  2. Select Add when prompted to sideload the app onto Teams on your local machine.
  1. Now the bot is successfully running on Teams! After the app is loaded, a chat session with the bot opens.
  1. You can type welcome to show an introduction card, and type learn to go to adaptive card and bot command documentation.
  1. You can do normal debugging activities, such as setting breakpoints, as if it were any other web application. The app supports hot reloading. If you change any file within the project, the page will be reloaded.

Preview your first bot app

  • 2 minutes remaining
  1. Provision your bot app in the cloud: You can provision your bot app in the cloud.
  2. Deploy your bot app to cloud: You can deploy your bot app to cloud.
  3. Preview your bot app in Teams: Your bot app opens in Teams.

To provision your bot app in the cloud

  1. Select Project > Teams Toolkit > Provision in the Cloud.
  1. Enter the following in the Provision dialog:
  2. Subscription name: Teams Cloud — Dev Test with TTL = 3 Days.
  3. Resource group: Select New to add the resource group generated for your app.
  4. Select your Region.
  5. Select Provision.
  1. Provision warning displays.
  2. Select Provision.
  1. It takes a few minutes for your resource group to provision in the cloud.
  2. After the provision is complete, select OK.
  1. Select View Provisioned Resources to view on Azure portal.
  1. Sign in to your Azure portal account on sign in prompt.
  2. Your app-dev-rg appears.
  1. Your resources are provisioned in the Azure portal!

To deploy your bot app to cloud

  1. Select Project > Teams Toolkit > Deploy to the Cloud.
  1. Select OK.
  1. Your bot app is successfully deployed to the cloud!

To preview your bot app in Teams

  1. Select Project > Teams Toolkit > Preview Teams app.
  1. Select Add when prompted to install the app to Teams.
  1. Now the bot is successfully running on Teams! After the app is loaded, a chat session with the bot opens.
  2. You can type welcome to show an introduction card.
  1. You can type learn to go to adaptive card and bot command documentation.

Congratulations!

  • 100% complete!

Comments