简体   繁体   English

如何在parameters.Azure Logic App Workflow定义中的parameters.json文件中使用参数

[英]How to use parameters inside parameters.json file in Azure Logic App Workflow definition

I have a requirement to use the parameters inside the workflow parameters Object similar to below.我需要使用工作流参数 Object 中的参数,如下所示。 But I am failing with the Azure Validation.但我在 Azure 验证方面失败了。

"parameters": {
    "$apprelatedparams": {
      "value": {
        "testId": "<GUID>",
        "testGroupName": "<GroupName>"
      }
    },
    "$connections": {
      "value": {
        "connectionName": {
          "connectionId": /test/@parameters['$apprelatedparams']['testId']/resourceGroups/@parameters['$apprelatedparams']['testGroupName']/providers/connectionName,
          "id": /test/@parameters['$apprelatedparams']['testId']/providers/testName
        }
      }
    }
  }

Here is the complete workflow with parameters object -这是带有参数 object 的完整工作流程 -

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
      "Response": {
        "inputs": {
          "body": "\"message\": \"Hello World!\"",
          "statusCode": 200
        },
        "runAfter": {},
        "type": "Response"
      }
    },
    "contentVersion": "",
    "outputs": {},
    "parameters": {},
  },
  "parameters": {
      "$apprelatedparams": {
      "value": {
        "testId": "TestID",
        "testGroupName": "GroupName"
      }
    },
     "$apprelatedparamstest": {
      "value": {
        "testsId": "@parameters['$apprelatedparams']['testId']",
        "testGroupsName": "@parameters['$apprelatedparams']['testGroupName']"
      }
    }
  }
}

Functions in expressions are called using parenthesis and not brackets. 表达式中的函数使用括号而不是方括号调用。 Therefore, you should transform your file into:因此,您应该将文件转换为:

"parameters": {
    "$apprelatedparams": {
      "value": {
        "testId": "<GUID>",
        "testGroupName": "<GroupName>"
      }
    },
    "$connections": {
      "value": {
        "connectionName": {
          "connectionId": "/test/@parameters('apprelatedparams')['testId']/resourceGroups/@parameters('apprelatedparams')['testGroupName']/providers/connectionName",
          "id": "/test/@parameters('apprelatedparams')['testId']/providers/testName"
        }
      }
    }
  }

See also Expressions for Workflow Definition Language as it explains what outputs you should expect depending on how you construct the call.另请参阅工作流定义语言的表达式,因为它解释了您应该期望的输出,具体取决于您构建调用的方式。

This is failing because of the structure of the json.由于 json 的结构,这是失败的。 Here is the json code that worked for me.这是对我有用的 json 代码。

{
  "parameters": {
    "$apprelatedparams": {
      "value": {
        "testId": "<GUID>",
        "testGroupName": "<GroupName>"
      }
    },
    "$connections": {
      "value": {
        "connectionName": {
          "connectionId": "test/@parameters['$apprelatedparams']['testId']/resourceGroups/@parameters['$apprelatedparams']['testGroupName']/providers/connectionName",
          "id": "/test/@parameters['$apprelatedparams']['testId']/providers/testName"
        }
      }
    }
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Azure Key Vault 读取和更新 Azure Logic App 的 parameters.json 文件中的机密信息 - How to read and update secrets information in parameters.json file of Azure Logic App from Azure Key Vault 使用外部参数。json 文件不适用于 Azure CLI - Use external parameters.json file not working with Azure CLI 在Azure Runbook Arm部署中使用parameters.json文件而不是-TemplateParameterObject - using parameters.json file instead of -TemplateParameterObject in Azure Runbook Arm deployments 我们需要参数吗?json 文件 ARM 模板部署 - do we need parameters.json file ARM template deployment 如何在构建定义工艺品中包含逻辑应用程序开发和 uat 参数 JSON 文件 - How to include logic app dev and uat parameters JSON file in Build Definition articrafts 如何触发 Azure Logic App 中的工作流以及触发器作为输入采用的参数? - How to trigger a workflow in Azure Logic App along with parameters taken by trigger as input? 部署ARM模板时使用PowerShell覆盖parameters.json文件中的参数 - Override a parameter in the parameters.json file with PowerShell when deploying ARM template 如何使用 powershell 设置 azure 逻辑应用程序参数 - How to set azure logic app parameters using powershell 在 Azure 逻辑应用程序中,如何在 http 请求中传递参数? - In Azure Logic App, how do I pass parameters in a http request? 如何在部署逻辑应用程序时使用 salesforce API 连接的参数? - How to use parameters for salesforce API connection while deployment of Logic app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM