簡體   English   中英

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字段的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM