在逻辑应用程序中声明和使用 "parameter"
Declaring and using a "parameter" in Logic Apps
在我的文件中
LogicApp.parameters.json
我已经声明了名为 MyFirstNewParameter 的额外参数
完整文件内容如下
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "MyFirstLogicAppOne"
},
"servicebus_1_connectionString": {
"value": "Endpoint=sb://notForYouToSee"
},
"MyFirstNewParameter": {
"value": "abc123"
}
}
}
在我的 LogicApp.json 文件中,我添加了 MyFirstNewParameter 的 "declaration"。
在
"parameters": {}
区域(下面第 4 行是该部分开始的地方)
我还添加了一个简单的响应,尝试读取参数值并将其发回响应中。 (命名为 "Read_And_Use_Parameter_Value_Simple_Response" 的所有事物)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewParameter."
},
"defaultValue": "My1NewParameterDefaultValue"
}
},
"variables": {},
"resources": [
{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
},
"runAfter": {}
}
},
"parameters": {},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {}
}
}
],
"outputs": {}
}
当我发送请求时,我在客户端中得到以下信息:
{
"error": {
"code": "NoResponse",
"message": "The server did not received a response from an upstream server. Request tracking id '000000000000000000000'."
}
}
当我检查门户时,生成以下错误:
模板无效。无法处理行“1”和列“1232”处的操作 'Read_And_Use_Parameter_Value_Simple_Response' 输入中的模板语言表达式:“未找到工作流参数 'MyFirstNewParameter'。”。
做什么?
如何在 Logic App LogicApp.parameters.json 中定义 "read" 参数?
感兴趣的网址
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#parameters
附加正确的工作代码
已接受的答案表明参数集存在歧义。
这是更正后的工作答案,名称明确。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "MylogicAppName"
},
"MyFirstNewArmParameter": {
"value": "ValueIWantToSeeShowUp"
}
}
}
和
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewArmParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewArmParameter."
},
"defaultValue": "My1NewArmParameterDefaultValue"
}
},
"variables": {
},
"resources": [{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewLogicAppParameter')}***"
},
"runAfter": {
}
}
},
"parameters": {
"MyFirstNewLogicAppParameter": {
"type": "string",
"defaultValue": "MyFirstNewLogicAppParameterDefaultValue"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {
}
},
"parameters": {
"MyFirstNewLogicAppParameter": {
"value": "[parameters('MyFirstNewArmParameter')]"
}
}
}
}],
"outputs": {
}
}
客户端现在收到预期值
**参数值为***ValueIWantToSeeShowUp*****
我也找到了这篇文章:
http://blog.ibiz-solutions.se/integration/logic-apps-parameters-vs-arm-parameters/
文章的第一段在下面,以防url将来停止工作(如果移动了可能会在互联网上搜索)
逻辑应用程序参数与 ARM 参数
我的问题是 ARM 模板参数和逻辑应用程序参数之间有什么区别,以及何时应该使用这些参数,所以这就是我将在本 post 中尝试解释的内容。
第一个 ARM 模板参数与 ARM 模板一起使用,ARM 模板在将基于 ARM 的资源部署到 Azure 时使用,而逻辑应用程序的资源是通过 ARM 模板部署的。 Logic App 背后的工作流定义语言与 ARM 模板非常相似,因此一开始很难看出差异。
作者:Mattias Lögdberg
我知道这很混乱,但是有 ARM Template 参数和 LogicApp 参数。您刚刚声明了 ARM 参数,但错过了 LogicApp 参数。然后您可以将 ARM 参数传递给 LogicApp 参数。
试试这个:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": ["eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewParameter."
},
"defaultValue": "My1NewParameterDefaultValue"
}
},
"variables": {
},
"resources": [{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
},
"runAfter": {
}
}
},
"parameters": {
"MyFirstNewParameter": {
"type": "string"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {
}
},
"parameters": {
"MyFirstNewParameter": {
"value": "[parameters('MyFirstNewParameter')]"
}
}
}
}],
"outputs": {
}
}
有关如何使用此 link 中的 ARM 模板和参数为 CI/CD 准备逻辑应用程序的一些提示和技巧:https://platform.deloitte.com.au/articles/preparing-azure-logic-apps-for-cicd
HTH
在我的文件中
LogicApp.parameters.json
我已经声明了名为 MyFirstNewParameter 的额外参数
完整文件内容如下
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "MyFirstLogicAppOne"
},
"servicebus_1_connectionString": {
"value": "Endpoint=sb://notForYouToSee"
},
"MyFirstNewParameter": {
"value": "abc123"
}
}
}
在我的 LogicApp.json 文件中,我添加了 MyFirstNewParameter 的 "declaration"。
在
"parameters": {}
区域(下面第 4 行是该部分开始的地方)
我还添加了一个简单的响应,尝试读取参数值并将其发回响应中。 (命名为 "Read_And_Use_Parameter_Value_Simple_Response" 的所有事物)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewParameter."
},
"defaultValue": "My1NewParameterDefaultValue"
}
},
"variables": {},
"resources": [
{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
},
"runAfter": {}
}
},
"parameters": {},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {}
}
}
],
"outputs": {}
}
当我发送请求时,我在客户端中得到以下信息:
{
"error": {
"code": "NoResponse",
"message": "The server did not received a response from an upstream server. Request tracking id '000000000000000000000'."
}
}
当我检查门户时,生成以下错误:
模板无效。无法处理行“1”和列“1232”处的操作 'Read_And_Use_Parameter_Value_Simple_Response' 输入中的模板语言表达式:“未找到工作流参数 'MyFirstNewParameter'。”。
做什么?
如何在 Logic App LogicApp.parameters.json 中定义 "read" 参数?
感兴趣的网址
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#parameters
附加正确的工作代码
已接受的答案表明参数集存在歧义。
这是更正后的工作答案,名称明确。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "MylogicAppName"
},
"MyFirstNewArmParameter": {
"value": "ValueIWantToSeeShowUp"
}
}
}
和
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewArmParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewArmParameter."
},
"defaultValue": "My1NewArmParameterDefaultValue"
}
},
"variables": {
},
"resources": [{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewLogicAppParameter')}***"
},
"runAfter": {
}
}
},
"parameters": {
"MyFirstNewLogicAppParameter": {
"type": "string",
"defaultValue": "MyFirstNewLogicAppParameterDefaultValue"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {
}
},
"parameters": {
"MyFirstNewLogicAppParameter": {
"value": "[parameters('MyFirstNewArmParameter')]"
}
}
}
}],
"outputs": {
}
}
客户端现在收到预期值
**参数值为***ValueIWantToSeeShowUp*****
我也找到了这篇文章:
http://blog.ibiz-solutions.se/integration/logic-apps-parameters-vs-arm-parameters/
文章的第一段在下面,以防url将来停止工作(如果移动了可能会在互联网上搜索)
逻辑应用程序参数与 ARM 参数 我的问题是 ARM 模板参数和逻辑应用程序参数之间有什么区别,以及何时应该使用这些参数,所以这就是我将在本 post 中尝试解释的内容。 第一个 ARM 模板参数与 ARM 模板一起使用,ARM 模板在将基于 ARM 的资源部署到 Azure 时使用,而逻辑应用程序的资源是通过 ARM 模板部署的。 Logic App 背后的工作流定义语言与 ARM 模板非常相似,因此一开始很难看出差异。
作者:Mattias Lögdberg
我知道这很混乱,但是有 ARM Template 参数和 LogicApp 参数。您刚刚声明了 ARM 参数,但错过了 LogicApp 参数。然后您可以将 ARM 参数传递给 LogicApp 参数。
试试这个:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": ["eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2",
"[resourceGroup().location]"],
"metadata": {
"description": "Location of the Logic App."
}
},
"MyFirstNewParameter": {
"type": "string",
"metadata": {
"description": "Name of the MyFirstNewParameter."
},
"defaultValue": "My1NewParameterDefaultValue"
}
},
"variables": {
},
"resources": [{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Read_And_Use_Parameter_Value_Simple_Response": {
"type": "Response",
"inputs": {
"statusCode": 200,
"body": "The parameter value is ***@{parameters('MyFirstNewParameter')}***"
},
"runAfter": {
}
}
},
"parameters": {
"MyFirstNewParameter": {
"type": "string"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
}
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {
}
},
"parameters": {
"MyFirstNewParameter": {
"value": "[parameters('MyFirstNewParameter')]"
}
}
}
}],
"outputs": {
}
}
有关如何使用此 link 中的 ARM 模板和参数为 CI/CD 准备逻辑应用程序的一些提示和技巧:https://platform.deloitte.com.au/articles/preparing-azure-logic-apps-for-cicd
HTH