在参数文件中获取当前订阅ID [英] Get current subscription id in parameter file
本文介绍了在参数文件中获取当前订阅ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样一个 azuredeploy.parameters.json 文件:
{
"$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"
}
}
}
我的目的是提取当前的subscriptionId并将其集成到 id
中.是否可以在参数文件中完成这项工作?
My aim is to extract the current subscriptionId and integrate it into the id
.
Is it possible in parameter file to do this job?
推荐答案
如果可行,正确的语法应为:
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
这篇关于在参数文件中获取当前订阅ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文