0
votes

I am trying to use a nested template in an Azure Blueprint artifact to deploy a Topic to an Azure Service Bus. This bus is created in a different subscription than the rest of the blueprint. I've been following this article: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-cross-resource-group-deployment

My artifact is defined as:

{
"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"

}

When importing the blueprint using Import-AzBlueprintWithArtifact -Name $blueprintName -ManagementGroupId $managementGroupId -InputPath $blueprintFolder -Force I receive the following error:

"ERROR! This artifact is invalid. Error: 'The template resource 'nestedTemplate' at line '13' and column '5' is invalid. 'SubscriptionId' property is not supported for nested deployments inside a deployment at subscription scope. Please see https://aka.ms/arm-template/#resources for usage details.'"

1

1 Answers

0
votes

the error tells you what is going on there, you cannot use a subscriptionid property for nested deployments inside a deployment at subscription scope. Try converting it to a linked template, that might work (or linked template inside resource group level deployment)