自动部署JSON映射

问题描述 投票:0回答:1

我在Azure中有一个Logic App,它使用Liquid map来转换JSON内容。我正在尝试使用New-AzureRmIntegrationAccountMap命令行开关和Set-AzureRmIntegrationAccountMap命令行开关来部署映射。

调用Set-AzureRmIntegrationAccountMap命令行开关时出现以下错误:

Set-AzureRmIntegrationAccountMap:无法反序列化响应。

使用此脚本:

Try
{
    Write-Host -ForegroundColor Green "Creating $baseName..."
    $mapContent = Get-Content -Path $fullName | Out-String

    Write-Host -ForegroundColor Cyan "$mapContent"

    New-AzureRmIntegrationAccountMap -ResourceGroupName $resourceGroupName -Name $iacName -MapName $baseName -MapDefinition $mapContent -ErrorAction Stop
    Write-Host -ForegroundColor Green "Successfully created $baseName"
}
Catch
{
    Write-Host -ForegroundColor Red "Error creating $baseName, trying update..."
    Set-AzureRmIntegrationAccountMap -ResourceGroupName $resourceGroupName -Name $iacName -MapName $baseName -MapDefinition $mapContent -Force
    if ($?) {
        Write-Host -ForegroundColor Green "Successfully updated $baseName"
    } else {
        Write-Host -ForegroundColor Red "Error updating $baseName"
        exit 1
    }
}

经过一些搜索后,这两个命令行开关接受MapType参数,但只允许一个值(XSLT)。

有没有办法在Azure的集成帐户中自动部署Liquid map(PowerShell,ARM模板...)?

azure liquid azure-logic-apps
1个回答
2
投票

有没有办法在Azure的集成帐户中自动部署Liquid map(PowerShell,ARM模板...)?

是的,我可以使用以下代码在PowerShell上创建Liquid map。

Login-AzureRmAccount
$IntegrationAccountName = "Integration Account name"
$ResouceGroupname = "ResourcegroupName" 
$ResourceLocation = "West US" # location
$ResourceName = "liquid name" 
$Content = Get-Content -Path "C:\Tom\simple.liquid" | Out-String
Write-Host $Content
$PropertiesObject = @{
    mapType = "liquid"
    content = "$Content"
    contentType = "text/plain"
}
New-AzureRmResource -Location $ResourceLocation -PropertyObject $PropertiesObject -ResourceGroupName $ResouceGroupname -ResourceType Microsoft.Logic/integrationAccounts/maps -ResourceName " $IntegrationAccountName/$ResourceName" -ApiVersion 2016-06-01 -Force

enter image description here

从天蓝色门户网站查看。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.