ARM模板错误'properties.api'在参数文件中无效?

时间:2018-01-18 18:03:23

标签: azure azure-resource-manager azure-logic-apps arm-template

我为bootstrap=True创建了parameter file

当我尝试使用此参数文件进行部署时,它会提供以下LogicApp project -

error

LogicApp.dev.parameters.json

 Template deployment returned the following errors:
Resource MICROSOFT.WEB/CONNECTIONS 'demo-sbs' failed with message '{
   "error": {
     "code": "InvalidRequestContent",
     "message": "The request content is not valid and could not be deserialized: 'The 'id' property 'aaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaa/providers/Microsoft.Web/locations/westeurope/managedApis/servicebus' under 'properties.api' is not valid.'."
   }
 }'

LogicApp.json(资源部分)

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "value": "demoapp"
    },
    "ResourceGroupName": {
      "value": "demo1"
    },
    "logicAppLocation": {
      "value": "westeurope"
    },
    "logicAppEnvironment": {
      "value": "DEV"
    },
    "sbs_Name": {
      "value": "demo-sbs"
    },
    "sbs_Connection_Name": {
      "value": "demo-sbs"
    },
    "sbs_Connection_DisplayName": {
      "value": "demo-sbs"
    },
    "nok_cb2b_we_sbs_connectionString": {
      "value": "Endpoint=sb://demo-sbs.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=asdasd/assasad"
    },
    "LogicAppIntegrationAccountName": {
      "value": "intdemo"
    },
      "subscriptionId": {
          "value": "aaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaa"
      }
  }
}

问题出在下面 - 当我尝试使用{I} "resources": [ { "type": "MICROSOFT.WEB/CONNECTIONS", "apiVersion": "2016-06-01", "name": "[parameters('demo-sbs_Connection_Name')]", "location": "[parameters('logicAppLocation')]", "properties": { "api": { "id": "[concat(parameters('subscriptionId'), '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'servicebus')]" }, "displayName": "[parameters('demo-sbs_Connection_DisplayName')]", "parameterValues": { "connectionString": "[parameters('demo-sbs_connectionString')]" } } } 之类的subscriptionId时,它会给出上面的错误,如果我使用concat(parameters('subscriptionId'),它就可以了。 我也想使用concat(subscription().id的参数。

2 个答案:

答案 0 :(得分:1)

那么,那是因为那不是资源ID在azure中的样子。

/subscriptions/subscription_guid/resourceGroups/resource_group_name/providers/microsoft.insights/components/resource_name

这就是它的样子。要使用resourceId功能,可以使用resourceGroup().id功能。 Link

或者您可以使用concat,但是您需要使用相同的字符串,您可以使用repeat set statusOld to checkStatus() set statusNew to checkStatus() repeat while statusOld is equal to statusNew delay 1 --for 1 second checks set statusNew to checkStatus() end repeat if statusNew is true then display dialog "Device Added - put some real code here" else display dialog "Device Removed - put some real code here" end if end repeat on checkStatus() (*Delete the 2 lines below when done testing*) --set myString to button returned of (display dialog "Connected?" buttons {"Yes", "No"}) --set myString to "name: DR-BT101 Connected: " & myString (*uncomment line below when done testing*) set myString to do shell script "system_profiler SPBluetoothDataTyp" --initial check if it's not even there if myString does not contain "Christian’s AirPods" then return false else --find out if connected/disconnected set AppleScript's text item delimiters to "name:" set myList to the text items of myString --each item of mylist is now one of the devices set numberOfDevices to count of myList set counter to 1 repeat numberOfDevices times --loop through each devices checking for Connected string if item counter of myList contains "Christian’s AirPods" then if item counter of myList contains "Connected: Yes" then return true else if item counter of myList contains "Connected: No" then return false else display dialog "Error Parsing" --this shouldn't happen end if end if set counter to counter + 1 end repeat end if end checkStatus 来帮助您。

答案 1 :(得分:1)

这是您正在做的正确语法:

                "api":{  
                "id":"[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/serviceBus')]"
            }