二头肌中的多行字符串插值不起作用

问题描述 投票:0回答:1

我在使用 Bicep 将变量插入多行字符串时遇到问题。

什么有效:

我有这个参数:

param fallbackResourceId string

插入到一个大的 json 多行字符串中,如下所示:

  "fallbackResourceIds": [
    "${fallbackResourceId}"
  ],

这可以在部署资源时评估该值。但是,我也有这个变量(也尝试作为参数):

param sourceDataCloudRoleName string
param sourceDataOperationName string
var sourceQuery1 = 'traces\r\n| extend prop_syncTableRowIds_array = parse_json(customDimensions.prop__syncRowIds)\r\n| mv-expand prop_syncRowIds_array\r\n| where tostring(prop_syncTableRowIds_array) contains {SyncTableRowId}\r\n| where cloud_RoleName =~ "${sourceDataCloudRoleName}" and operation_Name =~ "${sourceDataOperationName}"'

插入如下:

{
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "${sourceQuery1}",
              "size": 0,
              "title": "Search by \"SyncRowId\"",
              "timeContextFromParameter": "TimeRange",
              "queryType": 0,
              "resourceType": "microsoft.insights/components"
            },
            "name": "query - 1"
          },

但是,这里工作簿说参数没有赋值。

azure azure-bicep
1个回答
0
投票

我的问题是在多行字符串中使用字符串插值。 Microsoft 不建议这样做。相反,我使用替换功能,它不是那么“漂亮”,但可以完成工作,

© www.soinside.com 2019 - 2024. All rights reserved.