Home > Enterprise >  ARM : Get network Interface Private IP and Default Gateway
ARM : Get network Interface Private IP and Default Gateway

Time:08-03

im deploying an ARM template for a virtual machine with network interfaces

i have a .sh script that needs parameters to be passed to it

parameters :

NIC private ip

NIC default Gateway

nic template :

{
  "type": "Microsoft.Network/networkInterfaces",
  "apiVersion": "2019-06-01",
  "name": "[parameters('nic2name')]",
  "location": "[parameters('location')]",
  "dependsOn": [
    "[parameters('virtualNetworkName')]"
  ],
  "properties": {
    "ipConfigurations": [
      {
        "name": "ipconfig1",
        "properties": {
          "privateIPAllocationMethod": "Dynamic",
          "subnet": {
            "id": "[variables('subnetRef')]"
          },
          "primary": true
        }
      }
    ],
    "primary": false
  }
}

im sitting variables to get this parameters but idk how to get them

"smnet_dev": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nic2name')).ipConfigurations]",
"smnet_dflt_gw": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nic2name')).<default gateway>]"

i hope someone can guide me to the right direction

CodePudding user response:

AFAIK, We can not give it directly instead of that we can use PowerShell script or enter image description here enter image description here

enter image description here enter image description here

For more information please refer the below links:-

  • Related