This sample contains a script to easily migrate template gallery templates to templateSpec resources.

{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "pid-738e3eec-68d4-4667-8377-c05c77c21f1b", "properties": {"mode": "incremental", "template": {"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymenttemplate.json#", "contentversion": "1.0.0.0", "resources": []}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "dbtemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl, parameters('dbservertype'), ".json", parameters('_artifactslocationsastoken'))]"}}}{"condition": "[parameters('azurebackupswitch')]", "type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "recoverytemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"recoveryservices.json",parameters('_artifactslocationsastoken'))]"}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "redistemplate", "dependson": ["microsoft.resources/deployments/networktemplate"], "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"redis.json",parameters('_artifactslocationsastoken'))]"}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "name": "networktemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"network.json",parameters('_artifactslocationsastoken'))]"}}}{"condition": "[parameters('installelasticsearchswitch')]", "type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "dependson": ["microsoft.resources/deployments/networktemplate", "microsoft.resources/deployments/recoverytemplate"], "name": "elastictemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"elastic.json",parameters('_artifactslocationsastoken'))]"}}}{"condition": "[equals(parameters('fileservertype'),"gluster')]", "type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "dependson": ["microsoft.resources/deployments/networktemplate", "microsoft.resources/deployments/recoverytemplate"], "name": "glustertemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"gluster.json",parameters('_artifactslocationsastoken'))]"}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "dependson": ["microsoft.resources/deployments/elastictemplate", "microsoft.resources/deployments/glustertemplate", "microsoft.resources/deployments/recoverytemplate", "microsoft.resources/deployments/redistemplate", "microsoft.resources/deployments/storageaccounttemplate"], "name": "controllertemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"controller.json",parameters('_artifactslocationsastoken'))]"}}}{"type": "microsoft.resources/deployments", "apiversion": "2020-10-01", "dependson": ["microsoft.resources/deployments/controllertemplate", "microsoft.resources/deployments/redistemplate", "microsoft.resources/deployments/dbtemplate"], "name": "scalesettemplate", "properties": {"mode": "incremental", "parameters": {"moodlecommon": {"value": "[variables('moodlecommon')]"}, "location": {"value": "[parameters('location')]"}}, "templatelink": {"uri": "[concat(variables('moodlecommon').basetemplateurl,"webvmss.json",parameters('_artifactslocationsastoken'))]"}}}