Attila Szasz
Attila Szasz

Reputation: 3073

Install extensions when creating VSTS account with ARM template

I'm using powershell and an ARM template to create a new Team Services account + DevOps Project. Template type: microsoft.visualstudio/account

Is there a way to also install extensions via the template or powershell?

I have a couple of extensions I'm always using, It would be nice to automatically have them up and running on new projects.

Upvotes: 0

Views: 82

Answers (2)

Attila Szasz
Attila Szasz

Reputation: 3073

If anybody stumbles upon this same problem, here's how you can do it with powershell.
After creating the VSTS account, you need to log in and create a personal access token with Extensions (read and manage) in selected scopes.

$accountName = "yourAccount"
$personalAccessToken = "your-personal-access-token"

$uri = "https://" + $accountName + ".extmgmt.visualstudio.com/_apis/extensionmanagement/installedextensionsbyname/ms-appinsights/appinsightsreleaseannotations?api-version=5.0-preview.1"

Write-Host "Installing extension: Release Annotations for Azure Application Insights"
Invoke-RestMethod `
-Method Post `
-Uri $uri `
-ContentType application/json `
-Headers @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)")) }

Upvotes: 1

4c74356b41
4c74356b41

Reputation: 72171

thats an interesting question, if this is possible it should be mimicing this rest call.

That is most likely not possible with arm templates. Given this is not under reference on docs and the template says "operation": "link" i suppose there is no way of doing that.

Upvotes: 1

Related Questions