订阅范围内的部署中的嵌套部署不支持'SubscriptionId'属性

时间:2019-11-18 13:10:50

标签: azure azure-resource-manager azure-servicebus-subscriptions

我试图在Azure蓝图工件中使用嵌套模板将主题部署到Azure Service Bus。该总线是在与其余蓝图不同的订阅中创建的。我一直在关注这篇文章:https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-cross-resource-group-deployment

我的工件定义为:

{
"kind": "template",
"properties": {
    "template": {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "servicebusNamespace": {
                "type": "string"
            },
            "topicName": {
                "type": "string"
            }
        },
        "resources": [
            {
                "apiVersion": "2019-05-01",
                "name": "nestedTemplate",
                "type": "Microsoft.Resources/deployments",
                "resourceGroup": "myResourceGroup",
                "subscriptionId": "mySubscriptionId",
                "properties": {
                    "mode": "Incremental",
                    "template": {
                        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                        "contentVersion": "1.0.0.0",
                        "parameters": {},
                        "variables": {},
                        "resources": [
                            {
                                "type": "Microsoft.ServiceBus/namespaces/topics",
                                "apiVersion": "2017-04-01",
                                "name": "[concat(parameters('servicebusNamespace'), '/', parameters('topicName'))]",
                                "location": "North Europe",
                                "properties": {
                                    "defaultMessageTimeToLive": "P14D",
                                    "maxSizeInMegabytes": 1024,
                                    "requiresDuplicateDetection": false,
                                    "duplicateDetectionHistoryTimeWindow": "PT10M",
                                    "enableBatchedOperations": true,
                                    "status": "Active",
                                    "supportOrdering": true,
                                    "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S",
                                    "enablePartitioning": false,
                                    "enableExpress": false
                                }
                            }
                        ]
                    },
                    "parameters": {}
                }
            }
        ]
    },
    "parameters": {
        "servicebusNamespace": {
            "value": "[parameters('BP_servicebusNamespace')]"
        },
        "topicName": {
            "value": "[parameters('BP_topicName')]"
        }
    }
},
"type": "Microsoft.Blueprint/blueprints/artifacts"

}

使用Import-AzBlueprintWithArtifact -Name $blueprintName -ManagementGroupId $managementGroupId -InputPath $blueprintFolder -Force 导入蓝图时,出现以下错误:

“错误!此工件无效。错误:行'13'和列'5'的'模板资源'nestedTemplate'无效。 订阅范围内的部署内的嵌套部署不支持“ SubscriptionId”属性。有关用法的详细信息,请参见https://aka.ms/arm-template/#resources。'“

1 个答案:

答案 0 :(得分:0)

该错误告诉您发生了什么,您无法在订阅范围内的部署内的嵌套部署中使用subscriptionid属性。尝试将其转换为可能有效的链接模板(或资源组级别部署中的链接模板)