Powershell Save AzrWebApp func下载错误的源路径

Powershell Save AzrWebApp func下载错误的源路径,powershell,azure-web-app-service,azure-powershell,Powershell,Azure Web App Service,Azure Powershell,我正在使用该函数从Azure Web应用程序下载文件 下面介绍了如何执行此操作: 我的问题是:不管我设置了哪个SourcePath,它总是从wwwroot文件夹下载我的文件 我使用的代码示例: 实际上,我在SourcePath中输入的内容并不重要,即使不是现有的路径,它也会下载wwwroot的内容。 如何正确使用它?如果您想从web应用下载文件,可以通过powershell使用 试试下面的命令,它在我这方面工作得很好 $creds = Invoke-AzureRmResourceAction -

我正在使用该函数从Azure Web应用程序下载文件

下面介绍了如何执行此操作:

我的问题是:不管我设置了哪个SourcePath,它总是从wwwroot文件夹下载我的文件

我使用的代码示例:

实际上,我在SourcePath中输入的内容并不重要,即使不是现有的路径,它也会下载wwwroot的内容。
如何正确使用它?

如果您想从web应用下载文件,可以通过powershell使用

试试下面的命令,它在我这方面工作得很好

$creds = Invoke-AzureRmResourceAction -ResourceGroupName joywebapp -ResourceType Microsoft.Web/sites/config -ResourceName joywebapp2/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$username = $creds.Properties.PublishingUserName
$password = $creds.Properties.PublishingPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))

$apiUrl = "https://joywebapp2.scm.azurewebsites.net/api/vfs/site/wwwroot/Content/Site.css"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo);"If-Match"="*"} -Method GET -ContentType "multipart/form-data" -OutFile "C:\Users\joyw\Desktop\test.css"
测试结果:

更新:

如果你想下载一个文件夹,你可以使用我提到的文档中的,它允许下载一个zip文件的文件夹

示例命令:

$creds = Invoke-AzureRmResourceAction -ResourceGroupName joywebapp -ResourceType Microsoft.Web/sites/config -ResourceName joywebapp2/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$username = $creds.Properties.PublishingUserName
$password = $creds.Properties.PublishingPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))

$apiUrl = "https://joywebapp2.scm.azurewebsites.net/api/zip/site/wwwroot/Scripts/"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo);"If-Match"="*"} -Method GET -ContentType "multipart/form-data" -OutFile "C:\Users\joyw\Desktop\Scripts.zip"
注意:zip不包括顶部文件夹本身。确保你包括
尾随斜杠,例如,我下载脚本文件夹,我们需要在APIRL中使用Scripts/。

我需要下载一个文件夹。不,这不是我要求的。@DenisKoreyba它不下载文件夹吗?
$creds = Invoke-AzureRmResourceAction -ResourceGroupName joywebapp -ResourceType Microsoft.Web/sites/config -ResourceName joywebapp2/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$username = $creds.Properties.PublishingUserName
$password = $creds.Properties.PublishingPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))

$apiUrl = "https://joywebapp2.scm.azurewebsites.net/api/zip/site/wwwroot/Scripts/"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo);"If-Match"="*"} -Method GET -ContentType "multipart/form-data" -OutFile "C:\Users\joyw\Desktop\Scripts.zip"