You can use nested templates, like @4c74356b41 said, but you will still see the ugly "Select a resource group" field at the portal.
I have a similar problem (even if @4c74356b41 repeatedly claims that it doesn't make any sense). I want to generate the resource group name from a parameter.
You can find more about how to use nested templates here: Create resource group and deploy resources
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {
"someName": {
"type": "string"
}
},
"variables": {
"rgName": "[concat('rg-', parameters('someName'))]"
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2018-05-01",
"location": "[parameters('rgLocation')]",
"name": "[variables('rgName')]",
"properties": {}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2018-05-01",
"name": "rgDeployment",
"resourceGroup": "[variables('rgName')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/resourceGroups/', variables('rgName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
// PUT YOUR RESOURCES TEMPLATES HERE! //
}
],
"outputs": {}
}
}
}
],
"outputs": {}
}
Just replace the rgName
variable with the name of your actual resource group name.