Sitecore download url domain change

Might be old info but I realised it only today: If you are someone like me who uses PS script to download Sitecore artifacts, remember that the download url domain has changed  from https://sitecoredev.azureedge.net to https://scdp.blob.core.windows.net:

PS Script with new Download url:

#####

param(
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[string]$InstallSourcePath = (Join-Path $PSScriptRoot ".")
)
if (-not(Test-Path ".zip" -PathType Leaf)) {
$preference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
$sitecoreDownloadUrl = "https://scdp.blob.core.windows.net"
$packages = @{
"Sitecore 9.3.0 rev. 003498 (WDP XPSingle packages).zip" = "https://scdp.blob.core.windows.net/downloads/Sitecore%20Experience%20Platform/93/Sitecore%20Experience%20Platform%2093%20Initial%20Release/Secure/WDP/Sitecore%209.3.0%20rev.%20003498%20(WDP%20XPSingle%20packages).zip"
}
# download packages from Sitecore
$packages.GetEnumerator() | ForEach-Object {
$filePath = Join-Path $InstallSourcePath $_.Key
$fileUrl = $_.Value
if (Test-Path $filePath -PathType Leaf)
{
Write-Host ("Required package found: '{0}'" -f $filePath)
}
else
{
if ($PSCmdlet.ShouldProcess($fileName))
{
Write-Host ("Downloading '{0}' to '{1}'..." -f $fileUrl, $filePath)
Invoke-WebRequest -Uri $fileUrl -OutFile $filePath -UseBasicParsing
}
else
{
# Download package
Invoke-WebRequest -Uri $fileUrl -OutFile $filePath -UseBasicParsing
}
}
}
}

#####

PS Script with old Download url:

param(
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[string]$InstallSourcePath = (Join-Path $PSScriptRoot ".")
)
if (-not(Test-Path ".zip" -PathType Leaf)) {
$preference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
$sitecoreDownloadUrl = "https://sitecoredev.azureedge.net"
$packages = @{
"Sitecore 9.0.2 rev. 180604 (WDP XP0 packages).zip" = "https://sitecoredev.azureedge.net/~/media/F53E9734518E47EF892AD40A333B9426.ashx"
}
# download packages from Sitecore
$packages.GetEnumerator() | ForEach-Object {
$filePath = Join-Path $InstallSourcePath $_.Key
$fileUrl = $_.Value
if (Test-Path $filePath -PathType Leaf)
{
Write-Host ("Required package found: '{0}'" -f $filePath)
}
else
{
if ($PSCmdlet.ShouldProcess($fileName))
{
Write-Host ("Downloading '{0}' to '{1}'..." -f $fileUrl, $filePath)
Invoke-WebRequest -Uri $fileUrl -OutFile $filePath -UseBasicParsing
}
else
{
# Download package
Invoke-WebRequest -Uri $fileUrl -OutFile $filePath -UseBasicParsing
}
}
}
}

Script with old download url will throw this error:

PS C:\scia> .\SCIA-DownloadandSetupAllXP0SIFPrereqs.ps1

Downloading 'https://sitecoredev.azureedge.net/~/media/F53E9734518E47EF892AD40A333B9426.ashx' to 'C:\scia\.\Sitecore 9.0.2 rev. 180604 (WDP XP0 packages).zip'...

Invoke-WebRequest : The remote server returned an error: (308) Permanent Redirect.

At C:\scia\SCIA-DownloadandSetupAllXP0SIFPrereqs.ps1:38 char:4

+             Invoke-WebRequest -Uri $fileUrl -OutFile $filePath  -UseB ...

+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException

    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand




Comments