首页 文章

自动部署JSON映射

提问于
浏览
0

我在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模板...)?

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

相关问题