自动部署 JSON 地图
Automate deployment of JSON map
我在 Azure 中有一个逻辑应用程序,它使用液体贴图来转换 JSON 内容。我正在尝试使用 New-AzureRmIntegrationAccountMap commandlet and the Set-AzureRmIntegrationAccountMap commandlet 部署地图。
调用 Set-AzureRmIntegrationAccountMap
commandlet 时出现以下错误:
Set-AzureRmIntegrationAccountMap : Unable to deserialize the response.
使用此脚本:
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 的集成帐户(powershell、ARM 模板...)中自动部署 Liquid 地图?
Is there a way to automate the deployment of Liquid maps in an integration account in Azure (powershell, ARM template...) ?
是的,我可以使用以下代码在我这边使用 PowerShell 创建 Liquid 地图。
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
从 Azure 门户网站查看。
我在 Azure 中有一个逻辑应用程序,它使用液体贴图来转换 JSON 内容。我正在尝试使用 New-AzureRmIntegrationAccountMap commandlet and the Set-AzureRmIntegrationAccountMap commandlet 部署地图。
调用 Set-AzureRmIntegrationAccountMap
commandlet 时出现以下错误:
Set-AzureRmIntegrationAccountMap : Unable to deserialize the response.
使用此脚本:
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 的集成帐户(powershell、ARM 模板...)中自动部署 Liquid 地图?
Is there a way to automate the deployment of Liquid maps in an integration account in Azure (powershell, ARM template...) ?
是的,我可以使用以下代码在我这边使用 PowerShell 创建 Liquid 地图。
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
从 Azure 门户网站查看。