0

I have an Azure template and am attempting to deploy two extra resource groups.

{
  "type": "Microsoft.Resources/resourceGroups",
  "apiVersion": "2019-08-01",
  "location": "eastus",
  "name": "[variables('galleryResourceGroupName')]",
  "properties": {}
},
{
  "type": "Microsoft.Resources/resourceGroups",
  "apiVersion": "2019-08-01",
  "location": "[resourceGroup().location]",
  "name": "[variables('tempResourceGroupName')]",
  "properties": {}
},

When I run this template, the result for these two resources is:

{ "message": "No HTTP resource was found that matches the request URI 'https://management.azure.com/subscriptions/59b4b...9074/resourcegroups/rgMain/providers/Microsoft.Resources/resourceGroups/rgTemp?api-version=2019-08-01'." }

NotFound

The docs say you can deploy a resourceGroup: https://learn.microsoft.com/en-us/azure/templates/microsoft.resources/2019-08-01/resourcegroups

But it is not working... Any ideas why ?

jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
  • 1
    How are you deploying this template? – Gaurav Mantri Feb 13 '20 at 05:22
  • You need to use the complete template, not a part of it. See [template](https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-create-first-template?tabs=azure-cli). You need to put your groups in the resources. – Charles Xu Feb 13 '20 at 05:54

2 Answers2

1

This template is a subscription level template that creates a resource group. In this documentation you can find the ways to deploy this template.

enter image description here

Jagrati Modi
  • 2,038
  • 1
  • 13
  • 26
0

From the URI you seem to be targeting another resource group. You can't create a resource group within another resource group. You need to target the subscription instead!

Eric Smith
  • 2,340
  • 12
  • 16