You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Microsoft Azure App Service控制台压缩文件及安装压缩工具?

Solution for Compressing Large Files in Azure Kudu Console

Hey there! I totally get the frustration of dealing with 3GB+ files via FTP—super slow. Let's fix this compression issue in Kudu step by step.

First, Why Your Previous Commands Failed

  • compress is a Linux-only command, so it won't work in Windows-based Kudu CMD.
  • Compress-Archive is a PowerShell cmdlet—you were probably running it in the CMD tab instead of PowerShell.
  • zip isn't included by default in Windows CMD environments.

Option 1: Use Built-in PowerShell Compression (Easiest)

Kudu has a PowerShell tab—switch to it, and you can use the native Compress-Archive cmdlet without installing anything:

  1. Open your Azure App Service Kudu console (via https://<your-app-name>.scm.azurewebsites.net).
  2. Click the PowerShell tab at the top (instead of CMD).
  3. Run this command, adjusting the paths to match your files:
    # Compress all files in your target folder into a single zip
    Compress-Archive -Path "D:\home\site\wwwroot\your-large-files-folder\*" -DestinationPath "D:\home\site\wwwroot\large-archive.zip"
    
    • D:\home is the persistent storage path for your App Service, so your compressed file will stay there until you delete it.

Option 2: Use 7-Zip for Higher Compression (If You Need It)

If you want better compression ratios (smaller file size for faster downloads), you can temporarily install 7-Zip in the Kudu environment (it won't survive an app restart, but that's fine for one-off tasks):

  1. Stay in the PowerShell tab, and run these commands to set up 7-Zip:
    # Download the 7-Zip portable tools package
    Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-extra.7z" -OutFile "D:\home\7z-tools.7z"
    # Extract the package to a local folder
    Expand-Archive -Path "D:\home\7z-tools.7z" -DestinationPath "D:\home\7z"
    # Compress your files with 7-Zip (use .7z for better compression, or .zip)
    D:\home\7z\7z.exe a "D:\home\site\wwwroot\large-archive.7z" "D:\home\site\wwwroot\your-large-files-folder\*"
    
  2. Once done, you can delete the 7-Zip files if you want to free up space.

Downloading the Compressed File to Your New Server

Once the archive is ready, use wget from your new server to pull it directly (faster than FTP):

wget https://<your-app-name>.scm.azurewebsites.net/api/vfs/site/wwwroot/large-archive.zip --user <your-deployment-username> --password <your-deployment-password>

You can find your deployment credentials in the Azure Portal under your App Service > Deployment Center > FTP Credentials.

内容的提问来源于stack exchange,提问作者Arvind K.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 06:24:09