【问题标题】:Modify file in storage account using Azure Powershell Function App使用 Azure Powershell Function App 修改存储帐户中的文件
【发布时间】: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


    【解决方案1】:

    这不再是必需的,因为事实证明逻辑应用程序中有一个额外的设置,默认情况下没有设置,只需设置 Apply XSLT 输出属性,这个作业就很好了:

    【讨论】:

      猜你喜欢
      • 2020-11-05
      • 2023-03-23
      • 1970-01-01
      • 2021-01-03
      • 2017-06-26
      • 1970-01-01
      • 2017-06-20
      • 2020-01-13
      • 2021-09-21
      相关资源
      最近更新 更多