It seems that the issue is related to the size of the zip file and the distance between your location and the target region. The error message indicates that the client disconnected, which could be caused by a timeout issue. One possible solution is to split the large zip file into smaller chunks and upload them separately. Another solution is to use a different deployment method, such as FTP or Git. You can also try increasing the timeout value for the Publish-AzWebApp command by adding the -TimeoutSec
parameter with a higher value, such as 1200 (20 minutes).
You can split the large zip file into smaller chunks using the Split-File
cmdlet in PowerShell. Here's an example:
$sourceFile = "C:\path\to\large\file.zip"
$chunkSize = 100MB
$destinationFolder = "C:\path\to\output\folder"
$index = 0
$buffer = New-Object byte[] $chunkSize
$stream = New-Object System.IO.FileStream($sourceFile, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
while (($read = $stream.Read($buffer, 0, $chunkSize)) -gt 0) {
$chunkFile = Join-Path $destinationFolder ("chunk{0}.zip" -f $index++)
$fs = New-Object System.IO.FileStream($chunkFile, [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write)
$fs.Write($buffer, 0, $read)
$fs.Close()
}
$stream.Close()
This script reads the large zip file in chunks of 100MB and saves each chunk as a separate zip file in the specified output folder. You can adjust the chunk size and output folder as needed. Once you have split the large zip file into smaller chunks, you can upload them separately using the Publish-AzWebApp
command.