0
此前上傳文件發佈到使用FileZilla的蔚藍web應用程序。但我試圖2個或多個文件使用PowerShell腳本now.please幫我任何電源外殼上傳到蔚藍的Web應用程序腳本。如何上傳使用PowerShell腳本將發佈在蔚藍的Web應用程序文件
此前上傳文件發佈到使用FileZilla的蔚藍web應用程序。但我試圖2個或多個文件使用PowerShell腳本now.please幫我任何電源外殼上傳到蔚藍的Web應用程序腳本。如何上傳使用PowerShell腳本將發佈在蔚藍的Web應用程序文件
但我正在嘗試使用powershell腳本now.please上傳到azure網絡應用程序的2個或更多文件。
我認爲你可以使用PowerShell腳本(通過WebClient.UploadFile())部署使用FTP網絡應用程序代碼和遞歸上傳發布文件內容如下:
# Upload files recursively
Set-Location $appdirectory
$webclient = New-Object -TypeName System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($username,$password)
$files = Get-ChildItem -Path $appdirectory -Recurse | Where-Object{!($_.PSIsContainer)}
foreach ($file in $files)
{
$relativepath = (Resolve-Path -Path $file.FullName -Relative).Replace(".\", "").Replace('\', '/')
$uri = New-Object System.Uri("$url/$relativepath")
"Uploading to " + $uri.AbsoluteUri
$webclient.UploadFile($uri, $file.FullName)
}
$webclient.Dispose()
有關詳細信息,你可以參考Upload files to a web app using FTP。
此外,可以Using KUDU with Microsoft Azure Web Apps,單擊「調試控制檯>的PowerShell或CMD」打開控制檯,然後cd site\wwwroot
到你的Web應用程序的Web內容,那麼你可以拖動發佈文件,並直接拖放到的庫杜用於上傳文件的控制檯的文件瀏覽器UI。有關詳細信息,你可以參考Kudu console有關上傳文件。