Skip to content

Instantly share code, notes, and snippets.

@dgroh
Created April 3, 2021 18:56
Show Gist options
  • Save dgroh/058dd9af5b41ed16b16fececb1ac77ea to your computer and use it in GitHub Desktop.
Save dgroh/058dd9af5b41ed16b16fececb1ac77ea to your computer and use it in GitHub Desktop.
function PublishTeamsApp($FilePath, $AuthorizationToken) {
$baseUrl = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps"
$headers = @{}
$headers.Add("Authorization", "Bearer $AuthorizationToken")
$headers.Add("Content-Type", "application/zip")
try {
Invoke-RestMethod -Uri $baseUrl -Method 'POST' -Headers $headers -InFile $FilePath
}
catch {
if ($null -ne $_.ErrorDetails) {
Write-Error $_.ErrorDetails.Message
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment