This sample contains a script to easily migrate template gallery templates to templateSpec resources.
{"type": "microsoft.resources/deployments", "apiversion": "2019-10-01", "name": "[format('create-{0}", parameters('subscriptionalias'))]", "location": "[deployment().location]", "properties": {"expressionevaluationoptions": {"scope": "inner"}, "mode": "incremental", "parameters": {"billingaccount": {"value": "[parameters('billingaccount')]"}, "enrollmentaccount": {"value": "[parameters('enrollmentaccount')]"}, "subscriptionalias": {"value": "[parameters('subscriptionalias')]"}, "subscriptiondisplayname": {"value": "[parameters('subscriptiondisplayname')]"}, "subscriptionworkload": {"value": "[parameters('subscriptionworkload')]"}}, "template": {"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementgroupdeploymenttemplate.json#", "contentversion": "1.0.0.0", "metadata": {"_generator": {"name": "bicep", "version": "0.4.451.19169", "templatehash": "11044401809782387845"}}, "parameters": {"enrollmentaccount": {"type": "string", "metadata": {"description": "enrollmentaccount used for subscription billing"}}, "billingaccount": {"type": "string", "metadata": {"description": "billingaccount used for subscription billing"}}, "subscriptionalias": {"type": "string", "metadata": {"description": "alias to assign to the subscription"}}, "subscriptiondisplayname": {"type": "string", "metadata": {"description": "display name for the subscription"}}, "subscriptionworkload": {"type": "string", "metadata": {"description": "workload type for the subscription"}}}, "functions": [], "resources": [{"type": "microsoft.subscription/aliases", "apiversion": "2020-09-01", "scope": "/", "name": "[parameters('subscriptionalias')]", "properties": {"workload": "[parameters('subscriptionworkload')]", "displayname": "[parameters('subscriptiondisplayname')]", "billingscope": "[tenantresourceid('microsoft.billing/billingaccounts/enrollmentaccounts", parameters('billingaccount'), parameters('enrollmentaccount'))]"}}], "outputs": {"subscriptionid": {"type": "string", "value": "[reference(tenantresourceid('microsoft.subscription/aliases", parameters('subscriptionalias'))).subscriptionid]"}}}}} 