Azure Lighthouse - 获取订阅级别部署的区域
Azure Lighthouse - Get the region for subscription level deployment
我想将 Azure 订阅加入我的租户。为此,我使用 subscriptionDeploymentSchema
创建了一个 ARM 模板。如果我从门户打开此模板,系统会提示我选择区域。有什么方法可以将该内置字段的值放入我的模板中并使用它吗?
我想在我的字段“区域名称”中显示“区域”字段(内置)的值。那可能吗?
我知道对于资源组级别的部署我可以使用 resourceGroup().location
,但这在这里不起作用。
我的部分模板:
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mspOfferName": {
"type": "string",
"metadata": {
"description": "Specify a unique name for your offer"
}
},
"mspOfferDescription": {
"type": "string",
"metadata": {
"description": "Name of the Managed Service Provider offering"
}
},
"regionName": {
"type": "string",
"metadata": {
"description": "Should have value of the 'Region' built-in field"
}
}
},
"resources": [
...
{
"name": "myNestedTemplate",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"location": "<i-want-to-use-value-from-the-built-in-field>", // <-- I WANT TO USE REGION FROM THE BUILT-IN FIELD HERE
...
}
],
...
}
这可能吗?还是应该为用户创建一个字段来提供区域?第二个选项没有任何意义,因为系统会提示您提供两个位置。
您可以使用 deployment().location
获取 Region
字段的值。
我想将 Azure 订阅加入我的租户。为此,我使用 subscriptionDeploymentSchema
创建了一个 ARM 模板。如果我从门户打开此模板,系统会提示我选择区域。有什么方法可以将该内置字段的值放入我的模板中并使用它吗?
resourceGroup().location
,但这在这里不起作用。
我的部分模板:
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mspOfferName": {
"type": "string",
"metadata": {
"description": "Specify a unique name for your offer"
}
},
"mspOfferDescription": {
"type": "string",
"metadata": {
"description": "Name of the Managed Service Provider offering"
}
},
"regionName": {
"type": "string",
"metadata": {
"description": "Should have value of the 'Region' built-in field"
}
}
},
"resources": [
...
{
"name": "myNestedTemplate",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"location": "<i-want-to-use-value-from-the-built-in-field>", // <-- I WANT TO USE REGION FROM THE BUILT-IN FIELD HERE
...
}
],
...
}
这可能吗?还是应该为用户创建一个字段来提供区域?第二个选项没有任何意义,因为系统会提示您提供两个位置。
您可以使用 deployment().location
获取 Region
字段的值。