【发布时间】:2021-11-15 19:31:54
【问题描述】:
我正在使用逻辑应用程序将 CSV 文件转换为 XML 文件,但目前输出都在一行中。所以我在想也许我可以创建一个函数应用程序来打开文件,[xml] 它并保存文件,希望它能美化它,基本上是这样的:
$xml = [xml] (gc "filelocation")
$xml.Save("filelocation")
当我创建函数应用程序(称为 ParseXML)时,它已经有一个默认的 powershell 代码:
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
$body = "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
if ($name) {
$body = "Hello, $name. This HTTP triggered function executed successfully."
}
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $body
})
如何修改此代码和逻辑应用程序以尝试做我想做的事,我想我首先需要在 powershell 脚本中创建参数来定义我的文件在哪里以及它的名称,我可以从逻辑应用:
【问题讨论】:
标签: azure-functions azure-powershell