how to deploy network interface using bicep?

Thai Nguyen (Admin) 0 Reputation points
2024-05-28T02:14:36.55+00:00

Hi,
I am trying to deploy a network interface using the following command and it reports as successful but I don't see the interface created.

//deploy nic

param nicName string = 'ThaiNic'
param location string = resourceGroup().location
param virtualNetworkName string = 'az-nw-cmp-poc-vnet68' 
param subnetName string = 'snet19-128-private'
//param ipv4Address string = '10.19.68.180'

resource nic 'Microsoft.Network/networkInterfaces@2022-05-01' = {
  name: nicName
  location: location
  properties: {
    ipConfigurations: [
      {
        name: 'ipconfig1'
        properties: {
          privateIPAllocationMethod: 'Dynamic'
          //privateIPAddressVersion: 'IPv4'
         // privateIPAddress: ipv4Address
         subnet: {
          id: resourceId('Microsoft.Network/virtualNetworks/subnets', virtualNetworkName, subnetName)
        }          
        }
      }
    ]
  }
}
vWAN > az deployment group create --resource-group az-nw-cmp-rg01 --template-file modules/nics.bicep
A new Bicep release is available: v0.27.1. Upgrade now by running "az bicep upgrade".
{
  "id": "/subscriptions/9130bc8b-2167-4eed-bba7-5604fe12xxxx/resourceGroups/az-nw-cmp-rg01/providers/Microsoft.Resources/deployments/nics",     
  "location": null,
  "name": "nics",
  "properties": {
    "correlationId": "948de4a8-313a-407b-b155-6df557a41613",
    "debugSetting": null,
    "dependencies": [],
    "duration": "PT1.6042329S",
    "error": null,
    "mode": "Incremental",
    "onErrorDeployment": null,
    "outputResources": [],
    "outputs": null,
    "parameters": null,
    "parametersLink": null,
    "providers": [],
    "provisioningState": "Succeeded",
    "templateHash": "6609161197123188811",
    "templateLink": null,
    "timestamp": "2024-05-28T02:12:13.386062+00:00",
    "validatedResources": null
  },
  "resourceGroup": "az-nw-cmp-rg01",
  "tags": null,
  "type": "Microsoft.Resources/deployments"
}
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,256 questions
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 4,690 Reputation points
    2024-05-28T04:12:26.3566667+00:00

    Hi Thai Nguyen,

    Thanks for posting your question in the Microsoft Q&A forum.

    It seems that the network interface is being deployed successfully, but you are not able to see it in the Azure portal or when listing the resources.

    • Ensure that the name you are providing for the network interface (nicName parameter) follows the Azure naming conventions.
    • Double-check that you are looking for the network interface in the correct resource group. In your command, you are deploying the network interface to the az-nw-cmp-rg01 resource group
    • Double-check that you are looking for the network interface in the correct resource group.
    • Verify that you are deploying the Bicep file at the correct scope.
    • Ensure that you have the necessary permissions to create network interfaces in the resource group and subscription

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    0 comments No comments