Open VenkateshYembuluru opened 2 years ago
//1: Lets create a virtual network using ARM Template // create virtual Networks Basic Structure // Added Parameters // Added Variables // Added loop Statement -- Copy // Adedd NSG (Newteork Security Group) // Adedd Public IP Address
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "0.0.0.1",
"parameters": {
"vnetAddressspaces": {
"type": "string",
"metadata": {
"description": "Vnet address spaces."
},
"defaultValue": "192.195.0.0/16"
},
"vnetlocation": {
"type": "string",
"metadata": {
"description": "Vnet Location"
},
"defaultValue": "[resourceGroup().location]"
},
"subnetcidrranges": {
"type": "array",
"metadata": {
"description": "subnetcidrranges"
},
"defaultValue": [
"192.195.0.0/24",
"192.195.1.0/24"
]
}
},
"variables": {
//"subnetnames":["myvnet/web1","myvnet/db1"]
"networkname": "myvnet",
"subnetnames": [
"web1",
"web2"
],
"publicip":"webpublicip",
"nsgweb": "webnsg",
"nicweb":"webnic"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2019-12-01",
"name": "myvnet",
"location": "[parameters('vnetlocation')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressspaces')]"
]
}
}
},
{
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2019-12-01",
"name": "[concat(variables('networkname'), '/', variables('subnetnames')[copyIndex()])]",
"location": "[parameters('vnetlocation')]",
"properties": {
"addressPrefix": "[parameters('subnetcidrranges')[copyIndex()]]"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks',variables('networkname'))]"
],
"copy": {
"name": "copy cond",
"count": 2,
"mode": "Serial"
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-12-01",
"name": "[variables('nsgweb')]",
"location": "[resourceGroup().location]",
"tags": {
"Env": "Development",
"CreatedBy": "ARM"
},
"properties": {
"securityRules": [
{
"name": "openssh",
"properties": {
"description": "Open SSH",
"protocol": "tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "openhttp",
"properties": {
"description": "Open HTTP",
"protocol": "tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 110,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2019-11-01",
"name": "[variables('publicip')]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "[variables('publicip')]",
"Env": "Development",
"CreatedBy": "ARM"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "dnsname"
}
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2019-11-01",
"name": "[variables('nicweb')]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "[variables('nicweb')]",
"Env": "Development",
"CreatedBy": "ARM"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', variables('networkname'))]",
"[resourceId('Microsoft.network/networkSecurityGroups',variables('nsgweb'))]",
"[resourceId('Microsoft.Network/publicIPAddresses',variables('publicip'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipConfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('networkname'), variables('subnetnames')[0])]"
}
},
"publicIPAddresses":{
"id":"[resourceId('Microsoft.Network/publicIPAddresses',variables('publicip'))]"
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Newteork/networkSecurityGroups',variables('nsgweb'))]"
}
}
}
]
}
Dear Team, Public IP address issue resolved now. i identified and clear. but now i am getting the below
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"InvalidJson","message":"Could not find member 'publicIPAddresses' on object of type 'NetworkInterfaceIpConfiguration'. Path 'properties.ipConfigurations[0].publicIPAddresses', line 1, position 379."}]}
{ "code": "DeploymentFailed", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.", "details": [ { "code": "InvalidJson", "message": "Could not find member 'publicIPAddresses' on object of type 'NetworkInterfaceIpConfiguration'. Path 'properties.ipConfigurations[0].publicIPAddresses', line 1, position 379." } ] }
---------------------code-------------
//1: Lets create a virtual network using ARM Template // create virtual Networks Basic Structure // Added Parameters // Added Variables // Added loop Statement -- Copy // Adedd NSG (Newteork Security Group) // Adedd Public IP Address // Added Ubuntu VM
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "0.0.0.1",
}