Jumpstart Your Teams App Development with Teams Toolkit

Published Jan 31 2022 05:40 AM 1,191 Views
Microsoft

Introduction

Our team recently had the opportunity to revisit a ReactJS application that was built to create and manage project teams for virtual hackathon events. Since all the hackathon participants were already using Teams to collaborate during the event, we decided it made sense to convert our app to a Teams Tab app.

 

During this process, we discovered the Teams Toolkit Preview extension for VS Code. The toolkit made it very easy for us to create, debug, and deploy our new Teams App. Which greatly reduced the amount of development time and improved our developer workflow.

 

This article will highlight our process of getting started with the Teams Toolkit. So, hopefully you can make your next App a Teams App as well.

Pre-requisites

  • Visual Studio Code with Teams Toolkit extension installed
  • Microsoft 365 Account with ability to upload custom apps
  • Azure Subscription (if you want to deploy the hosting resources to Azure)

See this reference link for more information about these pre-requisites.

Creating a Teams App

Once the Teams Toolkit extension is installed, we use it to create a new Teams App.

pjirsa_0-1643569410289.png

A step-by-step wizard will ask a few questions. First, the type of app we want. In this case we’ll choose a Tab app, since our existing app is a web UI written in ReactJS. The Tab app will provide a similar experience and allow our app to become “Teams-aware”.

pjirsa_1-1643569410297.png

 

After the app is created, we need to sign-in to a Microsoft 365 account and Azure. The Azure sign-in is optional if we are not planning to deploy the hosting resources for the Teams app to Azure. Using Azure is the easiest way to get started, and the toolkit makes it almost a seamless process. So, I would recommend using Azure, at least initially.

 

*Pro Tip: Make sure the Microsoft 365 account and Azure subscription belong to the same Azure Active Directory tenant. If you need to do a production deployment to separate tenants, that will be possible after packaging up the app resources. But during development and debugging, the toolkit automation assumes that you are working in the same tenant.

Debug a Teams App

Now that our Teams app is created, and we’ve signed in to our M365 account, we can debug the app to make sure everything is working correctly.

 

Switch back to the file explorer tab, then expand the “tabs” folder in the project. This is the root folder containing the ReactJS application. Then, expand the “src/components” folder and open the Tab.jsx file. This top-level component is rendered when the app is loaded in Teams.

 

At the top of the page is a small “Play” button. Clicking this button will allow us to either debug our app locally or launch the app remotely if it has already been deployed. Choose the Debug option for your browser of choice. This will trigger Teams Toolkit to create a local build of the app, side-load it to your M365 tenant, and attach the debugger to a locally running version of the ReactJS app.

pjirsa_2-1643569410299.png

 

After a few moments, a new browser window will appear and prompt you to “Add” your local-debug version of the app to your Teams environment. It will then display the main page of the app, which is being hosted on your localhost.

 

Experiment with modifications to the Tab.jsx component, or any of the sample components, by making some small changes and adding breakpoints to see the debugging experience in action. Just like local development and debugging with ReactJS, the local server and debugger don’t need to be stopped when making code changes. Any watched jsx/js or other files will automatically trigger a hot reload of the app, even in Teams!

Deploy a Teams App

The Teams Toolkit has several actions available in the Deployment section that make it easy to build, package, and deploy your app. These actions are generally listed in the order used to deploy the backend resources and the app to Teams.

pjirsa_3-1643569410301.png

 

  1. Provision in the cloud – This action will execute the Bicep templates created by the toolkit to deploy the backend Azure resources for the app.
  2. Zip Teams metadata package – This action will bundle the Teams app manifest. Once created, another toolkit action can deploy it to Teams, or it can be manually uploaded to the Teams Store.
  3. Deploy to the cloud – This action will upload the backend resources, including the Tabs ReactJS app, to the provisioned Azure resources.
  4. Publish to Teams – This action will push the packaged Teams application to the Store.

Once these 4 actions have been completed, your app is now published and available for other users to find within your Teams Store.

Conclusion

In the example of our Team Builder app, we can migrate in the components from the existing app and integrate them into the component hierarchy under the root Tabs.jsx of the Teams app. With very few changes, the app is up and running as a Teams app. Now we can start refactoring the app to take advantage of its Teams-aware context. For example:

  • Replace existing authentication with the TeamsFX SDK
  • Swap out existing form and layout components for FluentUI to give it a Teams native look-and-feel
  • Add other Azure dependencies to the provisioning process of Teams Toolkit

Overall, our team has found working with the Teams Toolkit extension to be a time saver. It has reduced the complexity of configuring local development environments, provided a simple debugging experience, and allows us to easily deploy and test our Teams applications. I hope you’ll give it a try!

 

If you’d like to see our progress with Team Builder or use it as an example, head over to our GitHub repository at https://github.com/microsoft/hackathon-team-builder.

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-3089571%22%20slang%3D%22en-US%22%3EJumpstart%20Your%20Teams%20App%20Development%20with%20Teams%20Toolkit%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3089571%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22toc-hId-2134524496%22%20id%3D%22toc-hId-2135236565%22%3EIntroduction%3C%2FH1%3E%0A%3CP%3EOur%20team%20recently%20had%20the%20opportunity%20to%20revisit%20a%20ReactJS%20application%20that%20was%20built%20to%20create%20and%20manage%20project%20teams%20for%20virtual%20hackathon%20events.%20Since%20all%20the%20hackathon%20participants%20were%20already%20using%20Teams%20to%20collaborate%20during%20the%20event%2C%20we%20decided%20it%20made%20sense%20to%20convert%20our%20app%20to%20a%20Teams%20Tab%20app.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDuring%20this%20process%2C%20we%20discovered%20the%20Teams%20Toolkit%20%3CSUP%3EPreview%3C%2FSUP%3E%20extension%20for%20VS%20Code.%20The%20toolkit%20made%20it%20very%20easy%20for%20us%20to%20create%2C%20debug%2C%20and%20deploy%20our%20new%20Teams%20App.%20Which%20greatly%20reduced%20the%20amount%20of%20development%20time%20and%20improved%20our%20developer%20workflow.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20article%20will%20highlight%20our%20process%20of%20getting%20started%20with%20the%20Teams%20Toolkit.%20So%2C%20hopefully%20you%20can%20make%20your%20next%20App%20a%20Teams%20App%20as%20well.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-327070033%22%20id%3D%22toc-hId-327782102%22%3EPre-requisites%3C%2FH1%3E%0A%3CUL%3E%0A%3CLI%3EVisual%20Studio%20Code%20with%20Teams%20Toolkit%20extension%20installed%3C%2FLI%3E%0A%3CLI%3EMicrosoft%20365%20Account%20with%20ability%20to%20upload%20custom%20apps%3C%2FLI%3E%0A%3CLI%3EAzure%20Subscription%20(if%20you%20want%20to%20deploy%20the%20hosting%20resources%20to%20Azure)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ESee%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Ftoolkit%2Fteams-toolkit-fundamentals%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ereference%20link%3C%2FA%3E%20for%20more%20information%20about%20these%20pre-requisites.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--1480384430%22%20id%3D%22toc-hId--1479672361%22%3ECreating%20a%20Teams%20App%3C%2FH1%3E%0A%3CP%3EOnce%20the%20Teams%20Toolkit%20extension%20is%20installed%2C%20we%20use%20it%20to%20create%20a%20new%20Teams%20App.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pjirsa_0-1643569410289.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F343725iF573DEFEACD07C6F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22pjirsa_0-1643569410289.png%22%20alt%3D%22pjirsa_0-1643569410289.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EA%20step-by-step%20wizard%20will%20ask%20a%20few%20questions.%20First%2C%20the%20type%20of%20app%20we%20want.%20In%20this%20case%20we%E2%80%99ll%20choose%20a%20Tab%20app%2C%20since%20our%20existing%20app%20is%20a%20web%20UI%20written%20in%20ReactJS.%20The%20Tab%20app%20will%20provide%20a%20similar%20experience%20and%20allow%20our%20app%20to%20become%20%E2%80%9CTeams-aware%E2%80%9D.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pjirsa_1-1643569410297.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F343727iD2EF241A750750C3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22pjirsa_1-1643569410297.png%22%20alt%3D%22pjirsa_1-1643569410297.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20the%20app%20is%20created%2C%20we%20need%20to%20sign-in%20to%20a%20Microsoft%20365%20account%20and%20Azure.%20The%20Azure%20sign-in%20is%20optional%20if%20we%20are%20not%20planning%20to%20deploy%20the%20hosting%20resources%20for%20the%20Teams%20app%20to%20Azure.%20Using%20Azure%20is%20the%20easiest%20way%20to%20get%20started%2C%20and%20the%20toolkit%20makes%20it%20almost%20a%20seamless%20process.%20So%2C%20I%20would%20recommend%20using%20Azure%2C%20at%20least%20initially.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E*Pro%20Tip%3A%20Make%20sure%20the%20Microsoft%20365%20account%20and%20Azure%20subscription%20belong%20to%20the%20same%20Azure%20Active%20Directory%20tenant.%20If%20you%20need%20to%20do%20a%20production%20deployment%20to%20separate%20tenants%2C%20that%20will%20be%20possible%20after%20packaging%20up%20the%20app%20resources.%20But%20during%20development%20and%20debugging%2C%20the%20toolkit%20automation%20assumes%20that%20you%20are%20working%20in%20the%20same%20tenant.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1007128403%22%20id%3D%22toc-hId-1007840472%22%3EDebug%20a%20Teams%20App%3C%2FH1%3E%0A%3CP%3ENow%20that%20our%20Teams%20app%20is%20created%2C%20and%20we%E2%80%99ve%20signed%20in%20to%20our%20M365%20account%2C%20we%20can%20debug%20the%20app%20to%20make%20sure%20everything%20is%20working%20correctly.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESwitch%20back%20to%20the%20file%20explorer%20tab%2C%20then%20expand%20the%20%E2%80%9Ctabs%E2%80%9D%20folder%20in%20the%20project.%20This%20is%20the%20root%20folder%20containing%20the%20ReactJS%20application.%20Then%2C%20expand%20the%20%E2%80%9Csrc%2Fcomponents%E2%80%9D%20folder%20and%20open%20the%20Tab.jsx%20file.%20This%20top-level%20component%20is%20rendered%20when%20the%20app%20is%20loaded%20in%20Teams.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20the%20top%20of%20the%20page%20is%20a%20small%20%E2%80%9CPlay%E2%80%9D%20button.%20Clicking%20this%20button%20will%20allow%20us%20to%20either%20debug%20our%20app%20locally%20or%20launch%20the%20app%20remotely%20if%20it%20has%20already%20been%20deployed.%20Choose%20the%20Debug%20option%20for%20your%20browser%20of%20choice.%20This%20will%20trigger%20Teams%20Toolkit%20to%20create%20a%20local%20build%20of%20the%20app%2C%20side-load%20it%20to%20your%20M365%20tenant%2C%20and%20attach%20the%20debugger%20to%20a%20locally%20running%20version%20of%20the%20ReactJS%20app.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pjirsa_2-1643569410299.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F343726i83477AFC74AF6773%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22pjirsa_2-1643569410299.png%22%20alt%3D%22pjirsa_2-1643569410299.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20a%20few%20moments%2C%20a%20new%20browser%20window%20will%20appear%20and%20prompt%20you%20to%20%E2%80%9CAdd%E2%80%9D%20your%20local-debug%20version%20of%20the%20app%20to%20your%20Teams%20environment.%20It%20will%20then%20display%20the%20main%20page%20of%20the%20app%2C%20which%20is%20being%20hosted%20on%20your%20localhost.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EExperiment%20with%20modifications%20to%20the%20Tab.jsx%20component%2C%20or%20any%20of%20the%20sample%20components%2C%20by%20making%20some%20small%20changes%20and%20adding%20breakpoints%20to%20see%20the%20debugging%20experience%20in%20action.%20Just%20like%20local%20development%20and%20debugging%20with%20ReactJS%2C%20the%20local%20server%20and%20debugger%20don%E2%80%99t%20need%20to%20be%20stopped%20when%20making%20code%20changes.%20Any%20watched%20jsx%2Fjs%20or%20other%20files%20will%20automatically%20trigger%20a%20hot%20reload%20of%20the%20app%2C%20even%20in%20Teams!%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--800326060%22%20id%3D%22toc-hId--799613991%22%3EDeploy%20a%20Teams%20App%3C%2FH1%3E%0A%3CP%3EThe%20Teams%20Toolkit%20has%20several%20actions%20available%20in%20the%20Deployment%20section%20that%20make%20it%20easy%20to%20build%2C%20package%2C%20and%20deploy%20your%20app.%20These%20actions%20are%20generally%20listed%20in%20the%20order%20used%20to%20deploy%20the%20backend%20resources%20and%20the%20app%20to%20Teams.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pjirsa_3-1643569410301.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F343728i46E9F97D1542E17D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22pjirsa_3-1643569410301.png%22%20alt%3D%22pjirsa_3-1643569410301.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EProvision%20in%20the%20cloud%20%E2%80%93%20This%20action%20will%20execute%20the%20Bicep%20templates%20created%20by%20the%20toolkit%20to%20deploy%20the%20backend%20Azure%20resources%20for%20the%20app.%3C%2FLI%3E%0A%3CLI%3EZip%20Teams%20metadata%20package%20%E2%80%93%20This%20action%20will%20bundle%20the%20Teams%20app%20manifest.%20Once%20created%2C%20another%20toolkit%20action%20can%20deploy%20it%20to%20Teams%2C%20or%20it%20can%20be%20manually%20uploaded%20to%20the%20Teams%20Store.%3C%2FLI%3E%0A%3CLI%3EDeploy%20to%20the%20cloud%20%E2%80%93%20This%20action%20will%20upload%20the%20backend%20resources%2C%20including%20the%20Tabs%20ReactJS%20app%2C%20to%20the%20provisioned%20Azure%20resources.%3C%2FLI%3E%0A%3CLI%3EPublish%20to%20Teams%20%E2%80%93%20This%20action%20will%20push%20the%20packaged%20Teams%20application%20to%20the%20Store.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOnce%20these%204%20actions%20have%20been%20completed%2C%20your%20app%20is%20now%20published%20and%20available%20for%20other%20users%20to%20find%20within%20your%20Teams%20Store.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1687186773%22%20id%3D%22toc-hId-1687898842%22%3EConclusion%3C%2FH1%3E%0A%3CP%3EIn%20the%20example%20of%20our%20Team%20Builder%20app%2C%20we%20can%20migrate%20in%20the%20components%20from%20the%20existing%20app%20and%20integrate%20them%20into%20the%20component%20hierarchy%20under%20the%20root%20Tabs.jsx%20of%20the%20Teams%20app.%20With%20very%20few%20changes%2C%20the%20app%20is%20up%20and%20running%20as%20a%20Teams%20app.%20Now%20we%20can%20start%20refactoring%20the%20app%20to%20take%20advantage%20of%20its%20Teams-aware%20context.%20For%20example%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EReplace%20existing%20authentication%20with%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Ftoolkit%2Fteamsfx-sdk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETeamsFX%20SDK%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3ESwap%20out%20existing%20form%20and%20layout%20components%20for%20%3CA%20href%3D%22https%3A%2F%2Ffluentsite.z22.web.core.windows.net%2F0.60.1%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EFluentUI%3C%2FA%3E%20to%20give%20it%20a%20Teams%20native%20look-and-feel%3C%2FLI%3E%0A%3CLI%3EAdd%20other%20Azure%20dependencies%20to%20the%20provisioning%20process%20of%20Teams%20Toolkit%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EOverall%2C%20our%20team%20has%20found%20working%20with%20the%20Teams%20Toolkit%20extension%20to%20be%20a%20time%20saver.%20It%20has%20reduced%20the%20complexity%20of%20configuring%20local%20development%20environments%2C%20provided%20a%20simple%20debugging%20experience%2C%20and%20allows%20us%20to%20easily%20deploy%20and%20test%20our%20Teams%20applications.%20I%20hope%20you%E2%80%99ll%20give%20it%20a%20try!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%E2%80%99d%20like%20to%20see%20our%20progress%20with%20Team%20Builder%20or%20use%20it%20as%20an%20example%2C%20head%20over%20to%20our%20GitHub%20repository%20at%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fhackathon-team-builder%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoft%2Fhackathon-team-builder%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3089571%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22teamstoolkit.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F343904i8CE29734A66CD6F9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22teamstoolkit.png%22%20alt%3D%22teamstoolkit.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETeams%20Toolkit%20%3CSUP%3EPreview%3C%2FSUP%3E%20extension%20for%20Visual%20Studio%20Code%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3089571%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHLS_Hack%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Jan 31 2022 08:11 AM
Updated by: