0

我正在尝试使用 Azure 蓝图工件中的嵌套模板将主题部署到 Azure 服务总线。此总线是在与蓝图的其余部分不同的订阅中创建的。我一直在关注这篇文章: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了解使用详情。'"

4

1 回答 1

0

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

于 2019-11-18T13:25:32.813 回答