Azure ARM模板访问存储密钥

时间:2018-03-09 20:19:58

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

我正在尝试访问azure OMS ID,相同OMS的主键,存储帐户密钥,以下是我希望以此格式传递这些详细信息的命令sh ./install-master.sh <OMS ID> <OMS Key> <Storage Account Name> <Storage Account Key>

"protectedSettings": {
      "commandToExecute": "[concat('sh ./install-master.sh ',reference(resourceId(parameters('omsResourceGroup'),'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspace')), '2015-11-01-preview').customerId,' ',listKeys(resourceId(parameters('omsResourceGroup'),'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspace')), '2015-11-01-preview').primarySharedKey,' ',parameters('scriptStorageAccount'),' ',listKeys(resourceId('Microsoft.Storage/storageAccounts',parameters('scriptStorageAccount')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value))]"
     }

我收到以下错误消息

InvalidTemplate: Deployment template validation failed: 'The template resource 'node1/CustomInstall' at line '265' and column '10' is not valid: Unable to parse language expression 'concat('sh ./nifi-install-master.sh ',reference(resourceId(parameters('omsResourceGroup'),'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspace')), '2015-11-01-preview').customerId,' ',listKeys(resourceId(parameters('omsResourceGroup'),'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspace')), '2015-11-01-preview').primarySharedKey,' ',parameters('scriptStorageAccount'),' ',listKeys(resourceId('Microsoft.Storage/storageAccounts',parameters('scriptStorageAccount')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value))': expected token 'EndOfData' and actual 'RightParenthesis'.. Please see https://aka.ms/arm-template-expressions for usage details.'.

有没有其他方法可以测试我在ARM中传递的引用?

1 个答案:

答案 0 :(得分:1)

错误有点暗示你有一个额外的右括号:

xxx.keys[0].value))]" <<< remove one in the end