Reputation: 2630
We are trying to automate a Teams Tab App in our Azure Pipeline, but we are wondering if this even possible. We have already created the zip file for the app which can be uploaded via App Studio and it works. But we don't want the customers to do that via App Studio, instead, we want to automate this process on their pipeline. For that we created the following powershell:
# Generate zip file for deployment
$compress = @{
Path = "color.png", "outline.png", "manifest.json"
CompressionLevel = "Fastest"
DestinationPath = "app.zip"
}
Compress-Archive @compress -Update
Then we check if MicrosoftTeams
module is installed, otherwise we install it:
# Checks whether MicrosoftTeams module is available
if (Get-Module -ListAvailable -Name "MicrosoftTeams") {
Write-Verbose "MicrosoftTeams module already installed."
}
else {
Write-Verbose "Installing module MicrosoftTeams - https://learn.microsoft.com/en-us/powershell/module/teams/?view=teams-ps."
Install-Module MicrosoftTeams
}
Write-Verbose "Importing module MicrosoftTeams."
Import-Module MicrosoftTeams
And we connect with Microsoft Teams so we can install the app later:
Write-Verbose "Connecting to Microsoft Teams"
$user = "<<the account id>>"
Connect-MicrosoftTeams -AccountId $user
The problem here is that I'm always getting the prompt for device authentication:
Of course this would never work in a pipeline. How can I make this work? Can I use Token to connect with Teams?
Upvotes: 0
Views: 161
Reputation: 577
You can publish an app using Teams App Submission API to enable it across organization level. Please refer to this documentation for more details.
Upvotes: 5
Reputation: 10854
There is an ability to install an app for a user using the Microsoft Graph, which might be a better approach. See https://learn.microsoft.com/en-us/graph/api/userteamwork-post-installedapps?view=graph-rest-1.0&tabs=http . You can also see the option to list apps, which might be useful to check IDs etc.: https://learn.microsoft.com/en-us/graph/api/userteamwork-list-installedapps?view=graph-rest-1.0&tabs=http
Upvotes: 0