Skip to main content

PowerShell script to download the latest Windows 64-bit Cloud SQL Auth Proxy from GitHub.

$response = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/GoogleCloudPlatform/cloud-sql-proxy/releases/latest"

if ($response.body -cmatch '\[cloud-sql-proxy.x64.exe\]\((.*?)\)')
{
    $cloudProxyUrl = $matches[1]
    Write-Host "Downloading latest release: $cloudProxyUrl"
    Invoke-WebRequest $cloudProxyUrl -OutFile (Join-Path -Path $PSScriptRoot -ChildPath 'cloud-sql-proxy.exe')
}
else
{
    Write-Error 'Could not find regex match in release downloads body'
}