Skip to content

when i am trying creating ARM template and i am getting the error at IP Address creation. Please possible Please guide.. #113

@VenkateshYembuluru

Description

@VenkateshYembuluru

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",

"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"
        ]
    },
    "vmusername": {
        "type": "string",
        "metadata": {
            "description": "VM User Name"
        },
        "defaultValue": "adminuser"
    },
    "vmpass": {
        "type": "string",
        "metadata": {
            "description": "VM User Name"
        },
        "defaultValue": "password"
    }
},
"variables": {
    //"subnetnames":["myvnet/web1","myvnet/db1"]
    "networkname": "myvnet",
    "subnetnames": [
        "web1",
        "web2"
    ],
    "publicip":"webpublicip",
    "nsgweb": "webnsg",
    "nicweb":"webnic",
    "vmubuname":"ubuntuvm",
    "ubuntuvmSize":"Standard_B1s"
},
"resources": [
    {
        "type": "Microsoft.Network/virtualNetworks",
        "apiVersion": "2019-07-01",
        "name": "myvnet",
        "location": "[parameters('vnetlocation')]",
        "properties": {
            "addressSpace": {
                "addressPrefixes": [
                    "[parameters('vnetAddressspaces')]"
                ]
            }
        }
    },
    {
        "type": "Microsoft.Network/virtualNetworks/subnets",
        "apiVersion": "2019-07-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-07-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-07-01",
        "name": "[variables('publicip')]",
        "location": "[resourceGroup().location]",
        "tags": {
            "displayName": "[variables('publicip')]",
            "Env": "Development",
            "CreatedBy": "ARM"
        },
        "properties": {
            "publicIPAllocationMethod": "Dynamic",
            "dnsSettings": {
                "domainNameLabel": "venkatazure"
            }
        }
    },
    {
        "type": "Microsoft.Network/networkInterfaces",
        "apiVersion": "2019-07-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": "ipConfigaration",
                    "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'))]"
            }
        }
    },
    {
        "type": "Microsoft.Compute/virtualMachines",
        "apiVersion": "2019-07-01",
        "name": "[variables('vmubuname')]",            
        "location": "[resourceGroup().location]",
        "dependsOn": [
            "[resourceId('Microsoft.Network/virtualNetworks', variables('networkname'))]",
            "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgweb'))]",
            "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicip'))]",
            "[resourceId('Microsoft.Network/networkInterfaces',variables('nicweb'))]"
        ],
        "tags": {
            "displayName": "ubuntu-VM"
        },
        "properties": {
            "hardwareProfile": {
                "vmSize": "[variables('ubuntuvmSize')]"
            },
            "osProfile": {
                "computerName": "ubuntu - VM",
                "adminUsername": "[parameters('vmusername')]",
                "adminPassword": "[parameters('vmpass')]"
            },
            "storageProfile": {
                "imageReference": {
                    "publisher": "Canonical",
                    "offer": "0001-com-ubuntu-server-focal",
                    "sku": "20_04-lts-gen2",
                    "version": "latest"
                },
                "osDisk": {
                    "createOption": "FromImage",
                    "managedDisk": {
                        "storageAccountType": "Standard_LRS"
                    }
                }
            },
            "networkProfile": {
                "networkInterfaces": [
                    {
                        "id":  "[resourceId('Microsoft.Network/networkInterfaces',variables('nicweb'))]"
                    }
                ]
            }
        }
    }
]

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions