Grant tab device permission
Teams app that requires device permissions, such as location, camera, or microphone access, now require users to manually grant permission in the web browser. Previously, the browser handled how to grant access permissions, but now these permissions are handled in Microsoft Teams.
This step-by-step guide helps you to grant tab device permission at Teams. You'll see the following output:
Prerequisites
Ensure you install the following tools and set up your development environment:
| Install | For using... | |
|---|---|---|
| Required | ||
| Microsoft Teams | Microsoft Teams to collaborate with everyone you work with through apps for chat, meetings, call and all in one place. | |
| Microsoft 365 developer account | Access to Teams account with the appropriate permissions to install an app. | |
| Visual Studio 2022 version 17.3 Install one of the following two workloads: • ASP.NET and web development • .NET Core cross-platform development |
You can install the enterprise version in Visual Studio 2022, and install the workloads. | |
| Node.js and NPM | Back-end JavaScript runtime environment. Use the latest v16 LTS release. | |
| ngrok | Teams app features (conversational bots, message extensions, and incoming webhooks) require inbound connections. A tunnel connects your development system to Teams. It isn't required for apps that only include tabs. This package is installed within the project directory (using npm devDependencies). |
Note
After downloading ngrok, sign up and install authtoken.
Set up local environment
Open Microsoft Teams Samples.
Select Code.
From the dropdown menu, select Open with GitHub Desktop.
Select Clone.
Set up tunnel for local web server
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:
ngrok http --host-header=localhost 3000
Tip
If you encounter ERR_NGROK_4018, follow the steps, as displayed in the Command Prompt to sign up and authenticate ngrok. Then run the ngrok http --host-header=localhost 3000 command.
Set up manifest file
Go to manifest.json in cloned repository.
Open manifest.json in Visual Studio and make the following changes:
Replace
<<BASE_URI_DOMAIN>>with your http endpoint from ngrok excluding the https:// part in all the places.
Build and run client app using npm
In your cloned repository, go to samples > tab-device-permissions > nodejs.
Copy the nodejs folder path.
Open a new Command Prompt window, change the current directory to the copied nodejs path.
Run the following command in the Command Prompt to download packages and dependencies:
npm installRun the following command in the Command Prompt to start the app:
npm start
You can see the following output in the browser:
Add tab device permission to Teams
In your cloned repository, got to samples > tab-device-permissions > nodejs > appPackage.
Create a .zip with the following files that are present in the appPackage folder:
- manifest.json
- icon-outline.png
- icon-color.png
Go to Microsoft Teams.
Select Apps.
In the lower left corner, select Manage your apps.
Select Upload a custom app.
Select Open to upload the .zip file that you created in the appPackage folder.
Select Add.
Select Device Permission Tab to see the following output:
Test your app
To ensure that the tab device permission app enables user to give the permission, you must test the app after you successfully upload the app into Teams.
Complete challenge
Did you come up with something like this?
Congratulations!
You've completed the tutorial and now you can grant tab device permission at Teams.
Have an issue with this section? If so, please give us some feedback so we can improve this section.
Feedback
Submit and view feedback for