Get current subscription id in parameter file

懵懂的女人 提交于 2021-01-28 05:19:03

问题


I have such a azuredeploy.parameters.json file:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "adminLogin": {
      "value": "exampleadmin"
    },
    "adminPassword": {
      "reference": {
        "keyVault": {
          "id": "/subscriptions/[subscription().subscriptionId]/resourceGroups/ARMTemplate/providers/Microsoft.KeyVault/vaults/dev-kv"

        },
        "secretName": "ExamplePassword"
      }
    },
    "sqlServerName": {
      "value": "TestServer"
    }

  }
}

My aim is to extract the current subscriptionId and integrate it into the id. Is it possible in parameter file to do this job?


回答1:


if it works, the correct syntax would be:

"id": "[concat(subscription().id, '/resourceGroups/ARMTemplate/providers/Microsoft.KeyVault/vaults/dev-kv')]"

if it doesnt work you can use a nested deployment to pass it as an argument to a nested deployment and return the value from it or just execute your stuff in a nested deployment



来源:https://stackoverflow.com/questions/57060384/get-current-subscription-id-in-parameter-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!