I want to create a resource group
and after that create NSG
in same resource group.
ARM template –
{
"$schema": "http://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "deployment-rg",
"location": "easatus",
"subscriptionId": "[parameters('subscriptionId')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2021-04-01",
"name": "demo-test",
"location": "eastus",
"properties": {}
}
],
"outputs": {}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "deployment-nsg",
"comments": "test vnet",
"resourceGroup": "demo-test",
"dependsOn": [
"['deployment-rg']"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2020-05-01",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "nsg",
"location": "eastus",
"properties": {
"securityRules": [
{
"name": "AllowAll",
"properties": {
"priority": 100,
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "4489",
"sourceAddressPrefix": "Gateway",
"destinationAddressPrefix": "*",
"access": "Allow",
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": [],
"description": "more info."
}
}
]
},
"tags": {
"resourceType": "Demo NSG",
"clusterName": "Apps Demo"
}
}
]
}
}
}
]
}
I have used depends on as well in NSG still getting below error –
Error: Code=ResourceGroupNotFound; Message=Resource group
‘demo-test’ could not be found.
Any idea what is wrong here.