自动部署JSON地图 [英] Automate deployment of JSON map

查看:47
本文介绍了自动部署JSON地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure中有一个逻辑应用程序,该应用程序使用Liquid映射来转换JSON内容.我正在尝试使用

从azure门户进行检查.

I have a Logic App in Azure which use a Liquid map, to transform JSON content. I am trying to deploy the map using New-AzureRmIntegrationAccountMap commandlet and the Set-AzureRmIntegrationAccountMap commandlet.

I get the following error when calling the Set-AzureRmIntegrationAccountMap commandlet:

Set-AzureRmIntegrationAccountMap : Unable to deserialize the response.

With this script:

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
    }
}

After some searches, the two commandlets accept the MapType parameter, but only one value is allowed (XSLT).

Is there a way to automate the deployment of Liquid maps in an integration account in Azure (powershell, ARM template...) ?

解决方案

Is there a way to automate the deployment of Liquid maps in an integration account in Azure (powershell, ARM template...) ?

Yes, I could create Liquid map with PowerShell on my side with the following code.

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

Check it from azure portal.

这篇关于自动部署JSON地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆