Powershell
note: This guide is now considered legacy and use of the new API is recommended. A high level guide to migrate to the new API can be found here.
Get an Auth Token
Generate an External Auth Token for your build server to use from your Raygun User Settings page
Add script
Add this script somewhere your deployment process can use it:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string] $raygunAuthToken,
[Parameter(Mandatory=$True)]
[string] $raygunApiKey,
[Parameter(Mandatory=$True)]
[string] $version,
[Parameter(Mandatory=$True)]
[string] $ownerName,
[Parameter(Mandatory=$True)]
[string] $emailAddress,
[Parameter()]
[string] $scmIdentifier,
[Parameter()]
[string] $scmType,
[Parameter()]
[string] $releaseNotes
)
Write-Debug "Adding deployment in Raygun"
$url = "https://app.raygun.com/deployments?authToken=" + $raygunAuthToken
$command = ConvertTo-Json @{
apiKey = $raygunApiKey
version = $version
ownerName = $ownerName
emailAddress = $emailAddress
comment = $releaseNotes
scmIdentifier = $scmIdentifier
scmType = $scmType
}
$response = Invoke-WebRequest -Body $command `
-ContentType 'application/json; charset=utf-8' `
-Method 'POST' `
-Uri $url
if ($response.StatusCode -eq [System.Net.HttpStatusCode]::OK) {
Write-Debug "Added deployment in Raygun"
} else {
Write-Host "Error received when adding deployment in Raygun: " $response.StatusCode " - " $response.StatusDescription
}
Call the script
Call the deployment script after your release process is finished.
-raygunAuthToken Your External Auth Token
-raygunApiKey Your Application API Key
-version The version of your application that you've just deployed
-ownerName The name of the user who created this deployment
-scmIdentifier The identifier of the commit that this release was built from.
-scmType The source control system you are using. Default value is "GitHub".
Other options are "GitLab", "BitBucket", or "AzureDevOps"
-emailAddress The email address of the user who created this deployment
(should be a raygun user)
-releaseNotes The release notes for this deployment. Will be formatted as Markdown.