From 35b78b94f5efa1d5b8b84d83bad119f35446affb Mon Sep 17 00:00:00 2001 From: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:07:37 +0100 Subject: [PATCH] Fix: Overwrite user agent to get mysql apps via azure automation --- Evergreen/Apps/Get-mySQLConnectorNET.ps1 | 3 ++- Evergreen/Apps/Get-mySQLConnectorODBC.ps1 | 3 ++- Evergreen/Apps/Get-mySQLWorkbench.ps1 | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Evergreen/Apps/Get-mySQLConnectorNET.ps1 b/Evergreen/Apps/Get-mySQLConnectorNET.ps1 index a17d1617..a820377b 100644 --- a/Evergreen/Apps/Get-mySQLConnectorNET.ps1 +++ b/Evergreen/Apps/Get-mySQLConnectorNET.ps1 @@ -31,7 +31,8 @@ function Get-mySQLConnectorNET { # The version ist major.minor.patch, while the tag can have also have major.minor.patch.build $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceVersionShort, (($Version -split '\.')[0, 1] -join '.') -replace $res.Get.Download.ReplaceVersion, (($Version -split '\.')[0..2] -join '.') - $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] + # The website/CDN checks the user agent, which means that the call from e.g. Azure Automation is only possible by overwriting it + $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -UserAgent "Curl/8" -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] $PSObject = [PSCustomObject] @{ Version = $Version diff --git a/Evergreen/Apps/Get-mySQLConnectorODBC.ps1 b/Evergreen/Apps/Get-mySQLConnectorODBC.ps1 index f9c0b57a..335d16d4 100644 --- a/Evergreen/Apps/Get-mySQLConnectorODBC.ps1 +++ b/Evergreen/Apps/Get-mySQLConnectorODBC.ps1 @@ -30,7 +30,8 @@ function Get-mySQLConnectorODBC { # The version ist major.minor.patch, while the tag can have also have major.minor.patch.build $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceVersion, (($Version -split '\.')[0..2] -join '.') - $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] + # The website/CDN checks the user agent, which means that the call from e.g. Azure Automation is only possible by overwriting it + $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -UserAgent "Curl/8" -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] $PSObject = [PSCustomObject] @{ Version = $Version diff --git a/Evergreen/Apps/Get-mySQLWorkbench.ps1 b/Evergreen/Apps/Get-mySQLWorkbench.ps1 index 75df4532..28b94778 100644 --- a/Evergreen/Apps/Get-mySQLWorkbench.ps1 +++ b/Evergreen/Apps/Get-mySQLWorkbench.ps1 @@ -30,7 +30,8 @@ function Get-mySQLWorkbench { # The version ist major.minor.patch, while the tag can have also have major.minor.patch.build $Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceVersion, (($Version -split '\.')[0..2] -join '.') - $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] + # The website/CDN checks the user agent, which means that the call from e.g. Azure Automation is only possible by overwriting it + $CdnUri = (Invoke-WebRequest $Uri -MaximumRedirection 0 -UserAgent "Curl/8" -SkipHttpErrorCheck -ErrorAction:SilentlyContinue).Headers.Location[0] $PSObject = [PSCustomObject] @{ Version = $Version