Hi @Riaz Ansary Greetings! Thank you for posting this question here.
As the error message indicates, the ARM template should deploy the resources at the resource group level. However, looks like template is not formatted to target the resource group. When deploying to a subscription, there are different template formats you can follow to deploy resources to:
- the target subscription from the operation
- any subscription in the tenant
- resource groups within the subscription or other subscriptions
- the tenant for the subscription
To deploy resources to a resource group within the subscription, add a nested deployment and include the resourceGroup
property. In the following example, the nested deployment targets a resource group named demoResourceGroup
.
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "nestedDeployment",
"resourceGroup": "demoResourceGroup",
"properties": {
"mode": "Incremental",
"template": {
resource-group-resources
}
}
}
],
"outputs": {}
}
Please refer the sample provided in the article section Create resource group and resources to deploy resources to a resource group using a nested template.
Hope this helps! Please let us know if you have any additional questions or need further clarification.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.