Is it supported to have a single ARM file that is deployed on a resource-group level and still deploy another resource group, and resource to it? And if yes, how does one have to address the resourceId for the dependsOn parameter?
I'm deploying like the following (I need to deploy on a resource group level - don't ask).
New-AzResourceGroupDeployment -Templatefile deploy.json -Location 'xx' -ResourceGroupName 'firstResourceGroup'
And have, in this ARM file, a resource group deployment
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2020-06-01",
"location": "[parameters('location')]",
"name": "[parameters('SecondResourceGroup')]",
"properties": {}
}
and specify a further deployment (Microsoft.Resources/deployments) to this resource group.
{
"type": "Microsoft.Resources/deployments",
"name":"deployment-to-secondResourceGroup",
"apiVersion": "2020-06-01",
"resourceGroup": "[parameters('secondResourceGroup')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "https://xyz"
}
}
}
This works fine if the resource group is already deployed, that is. But in reality, the resource group won't be ready to deploy to. So I need to set a dependsOn.
But when I try to use the dependsOn parameters I can't address the resource-group deployment.
"dependsOn": []