部署后,队列名称不与Azure逻辑应用程序结合

发布于 2025-01-21 10:18:54 字数 800 浏览 0 评论 0原文

我正在尝试将Azure Logic应用程序部署到两个环境 ie。 dev and prod。

我正在为逻辑应用程序和环境使用一个JSON文件,我有不同的参数文件。 Azure管道根据环境选择参数文件。参数文件中定义的所有参数在部署期间都受到限制,但是我对队列名称有问题。

这就是我在参数文件中定义参数的方式:

"parameters": {
  "logicAppName": {
    "value": "Test-App-dev"
  },
  "QueueName": { "value": "testdev" }
}

这就是逻辑应用程序中的路径变量中使用的方式:

”

但是部署后,排队名称在Azure Portal上没有反映。这就是Azure门户中的样子:

”在此处输入图像描述

I am trying to deploy the Azure logic app to two environments ie. dev and prod.

I am using a single json file for the logic app and for the environments I have different parameter files. The Azure pipeline picks the parameter file as per the environment. All the parameters defined in the parameters files get bound during deployment, but I'm having issues with the queue name.

This is how I am defining parameters in the parameters files:

"parameters": {
  "logicAppName": {
    "value": "Test-App-dev"
  },
  "QueueName": { "value": "testdev" }
}

This is how it is used in path variable in logic app json file:

enter image description here

But after deployment, the queue name is not reflecting on the Azure portal. This is how it looks like in the Azure portal:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光沙漏 2025-01-28 10:18:54

从我们的末端重现后,我们发现这是由于一个无效的模板。这是我们能够实现所需值的方式。

  1. 创建以下参数

     “参数”:{
        ........
        ,,,,
        “ queueName”:{
          “ DefaultValue”:“ TestDev”,
          “类型”:“字符串”
        }
      }     
     
  2. 现在您需要在模板的参数

    中添加相同

     “参数”:{
                “ $ Connections”:{
                  “价值”: {
                    “ servicebus_1”:{
                      “ ConnectionId”:“ [parameters('Connections_servicebus_1_1_externalId')]”,
                      “ ConnectionName”:“ ServiceBus-1”,
                      “ID”: ”***”
                    }
                  }
                },,
                “ queueNamedev”:{
                  “ value”:“ [parameters('queueName')]”
                }
              }
     
  3. 中添加相同的内容,在定义的参数

    中声明相同

     “参数”:{
                    “ $ Connections”:{
                      “ DefaultValue”:{},
                      “类型”:“对象”
                    },,
                    “ $ queuenamedev”:{
                      “ DefaultValue”:{},
                      “类型”:“字符串”
                    }
                  }
     

结果中声明相同的结果:
最后,我们能够将其价值读成“ TestDev”。您可以从参数检查queuenamedev的值读为testdev。

“在此处输入图像说明”

下面是我的逻辑应用程序的模板

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
  "parameters": {
    "workflows_LogicApp12_name": {
      "defaultValue": "LogicApp12",
      "type": "String"
    },
    "connections_servicebus_1_externalid": {
      "defaultValue": "/subscriptions/<YourSubscriptionID>/resourceGroups/<YourResourceGroup>/providers/Microsoft.Web/connections/servicebus-1",
      "type": "String"
    },
    "QueueName": {
      "defaultValue": "testdev",
      "type": "String"
    }
  },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Logic/workflows",
            "apiVersion": "2017-07-01",
            "name": "[parameters('workflows_LogicApp12_name')]",
            "location": "centralus",
            "properties": {
                "state": "Enabled",
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                  "parameters": {
                    "$connections": {
                      "defaultValue": {},
                      "type": "Object"
                    },
                    "QueueNamedev": {
                      "defaultValue": {},
                      "type": "String"
                    }
                  },
                    "triggers": {
                        "When_a_message_is_received_in_a_queue_(auto-complete)": {
                            "recurrence": {
                                "frequency": "Minute",
                                "interval": 3
                            },
                            "evaluatedRecurrence": {
                                "frequency": "Minute",
                                "interval": 3
                            },
                            "type": "ApiConnection",
                          "inputs": {
                            "host": {
                              "connection": {
                                "name": "@parameters('$connections')['servicebus_1']['connectionId']"
                              }
                            },
                            "method": "get",
                            "path": "/@{encodeURIComponent(encodeURIComponent(parameters('QueueNamedev')))}/messages/head",
                            "queries": {
                              "queueType": "Main"
                            }
                          }
                        }
                    },
                    "actions": {},
                    "outputs": {}
                },
              "parameters": {
                "$connections": {
                  "value": {
                    "servicebus_1": {
                      "connectionId": "[parameters('connections_servicebus_1_externalid')]",
                      "connectionName": "servicebus-1",
                      "id": "/subscriptions/<YourSubscriptionID>/providers/Microsoft.Web/locations/centralus/managedApis/servicebus"
                    }
                  }
                },
                "QueueNamedev": {
                  "value": "[parameters('QueueName')]"
                }
              }
            }
        }
    ]
}

After reproducing from our end, we found that this is due to an invalid template. Here is how we could able to pull off the required value.

  1. Created the below parameter

    "parameters": {
        ........
        ,
        "QueueName": {
          "defaultValue": "testdev",
          "type": "String"
        }
      }     
    
  2. Now you need to add the same in the template's parameter

    "parameters": {
                "$connections": {
                  "value": {
                    "servicebus_1": {
                      "connectionId": "[parameters('connections_servicebus_1_externalid')]",
                      "connectionName": "servicebus-1",
                      "id": "***"
                    }
                  }
                },
                "QueueNamedev": {
                  "value": "[parameters('QueueName')]"
                }
              }
    
  3. Declare the same in your definition's parameter

    "parameters": {
                    "$connections": {
                      "defaultValue": {},
                      "type": "Object"
                    },
                    "$QueueNamedev": {
                      "defaultValue": {},
                      "type": "String"
                    }
                  }
    

RESULT:
Finally, we could able to read its value as 'testdev'. You can check from parameters that the value of QueueNamedev is read as testdev.

enter image description here

Below is the template of my logic app

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
  "parameters": {
    "workflows_LogicApp12_name": {
      "defaultValue": "LogicApp12",
      "type": "String"
    },
    "connections_servicebus_1_externalid": {
      "defaultValue": "/subscriptions/<YourSubscriptionID>/resourceGroups/<YourResourceGroup>/providers/Microsoft.Web/connections/servicebus-1",
      "type": "String"
    },
    "QueueName": {
      "defaultValue": "testdev",
      "type": "String"
    }
  },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Logic/workflows",
            "apiVersion": "2017-07-01",
            "name": "[parameters('workflows_LogicApp12_name')]",
            "location": "centralus",
            "properties": {
                "state": "Enabled",
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                  "parameters": {
                    "$connections": {
                      "defaultValue": {},
                      "type": "Object"
                    },
                    "QueueNamedev": {
                      "defaultValue": {},
                      "type": "String"
                    }
                  },
                    "triggers": {
                        "When_a_message_is_received_in_a_queue_(auto-complete)": {
                            "recurrence": {
                                "frequency": "Minute",
                                "interval": 3
                            },
                            "evaluatedRecurrence": {
                                "frequency": "Minute",
                                "interval": 3
                            },
                            "type": "ApiConnection",
                          "inputs": {
                            "host": {
                              "connection": {
                                "name": "@parameters('$connections')['servicebus_1']['connectionId']"
                              }
                            },
                            "method": "get",
                            "path": "/@{encodeURIComponent(encodeURIComponent(parameters('QueueNamedev')))}/messages/head",
                            "queries": {
                              "queueType": "Main"
                            }
                          }
                        }
                    },
                    "actions": {},
                    "outputs": {}
                },
              "parameters": {
                "$connections": {
                  "value": {
                    "servicebus_1": {
                      "connectionId": "[parameters('connections_servicebus_1_externalid')]",
                      "connectionName": "servicebus-1",
                      "id": "/subscriptions/<YourSubscriptionID>/providers/Microsoft.Web/locations/centralus/managedApis/servicebus"
                    }
                  }
                },
                "QueueNamedev": {
                  "value": "[parameters('QueueName')]"
                }
              }
            }
        }
    ]
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文