使用PSFTP Powershell模块

时间:2017-09-29 02:50:59

标签: powershell azure azure-web-app-service

我正在使用microsoft提供的名为PSFTP的powershell模块。当脚本在任何开发人员Windows 10 powershell上运行时,它工作正常,但在构建服务器上它失败并显示错误消息(530)未登录。为什么它只能在Windows Server 2016上失败?它是具有相同凭据的相同脚本。

PSFTP来源在这里https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb

$username = "azureusername"
$password = ConvertTo-SecureString "azurepassword" -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$ftpserver = "ftp://*****ftp.azurewebsites.windows.net"
$fileToDelete = "/site/wwwroot/bin"
Set-FTPConnection -Credentials $cred -Server $ftpserver -Session MyFTPSession -UsePassive
$Session = Get-FTPConnection -Session MyFTPSession
Remove-FTPItem -Session $Session -Path $fileToDelete

1 个答案:

答案 0 :(得分:0)

根据您的描述,我在Windows Server 2016中进行测试,如果我使用从Portal Get publish profile下载的用户名和密码。我和你一起得到了同样的错误日志。

enter image description here

我在Azure门户上设置了用户名和密码。 enter image description here

这对我很有用。

enter image description here

相关问题