[英]Azure Devops Release Pipeline - Deploy single file to Azure App Service
I have a single file that I need to deploy to an existing App Service (that already contains an application, deployed previously through another pipeline).我有一个文件需要部署到现有的应用程序服务(已经包含一个应用程序,之前通过另一个管道部署)。
I would like to avoid using the FTP task for that.我想避免为此使用 FTP 任务。
Is there a way to deploy a single file to a specific folder in an App Service via a DevOps Pipeline?有没有办法通过 DevOps 管道将单个文件部署到应用服务中的特定文件夹?
Actually FTP seems to be the easiest way to deploy single file.实际上 FTP 似乎是部署单个文件的最简单方法。 However if you don't want to use it you can use KUDU API .
但是,如果您不想使用它,可以使用KUDU API 。 What you need is to wrap it in powershell script:
您需要的是将其包装在 powershell 脚本中:
$username = '$(username)'
$password = '$(password)'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiUrl = "https://$(siteName).scm.azurewebsites.net/api/vfs/site/your-file"
$filePath = "$(System.DefaultWorkingDirectory)/your-file"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", ("Basic {0}" -f $base64AuthInfo))
$headers.Add("If-Match", "*")
Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method PUT -InFile $filePath -ContentType "multipart/form-data"
Here you find info how to get credentials .在这里您可以找到有关如何获取凭据的信息。
But if this is one time task you may use drag & drop from KUDU panel as it is mentioned here但是,如果这是一次性任务,您可以使用 KUDU 面板中的拖放操作,如此处所述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.