az network nic ip-config update error

Vedanth Pulipati 241 Reputation points
2022-02-20T15:40:42.777+00:00

while trying to run the below command to update the ipconfig facing the below error

az network nic ip-config update -g ${resourceGroup} --nic-name nic-${vmName} -n ipconfig1 --application-security-groups ${asgId}

error:
176191-image.png

post the error as it's displayed to use private ip even tried the below command but facing same issue

az network nic ip-config update --name ipconfig1 --nic-name ${env:NetworkInterfaceName} --private-ip-address XX.XX.XX.XX --resource-group ${env:ResourceGroupName}

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,394 questions
{count} votes

Accepted answer
  1. GitaraniSharma-MSFT 49,461 Reputation points Microsoft Employee
    2022-02-21T09:59:07.2+00:00

    Hello @Vedanth Pulipati ,

    Thank you for the update.

    You can refer the below doc which shows how to associate an IP configuration with an application security group via Azure PowerShell commands:
    https://learn.microsoft.com/en-us/powershell/module/az.network/set-aznetworkinterfaceipconfig?view=azps-7.2.0#2--associating-an-ip-configuration-with-an-application-security-group

    To do the same via Azure CLI, please use the below command:

    az network nic ip-config update -g RGname --nic-name nicname -n ipconfig1 --private-ip-address 10.0.1.4 --subnet subnetname --vnet-name vnetname --application-security-groups asgname  
    

    NOTE: You will need to provide the Vnet name, subnet name, nic name & private IP address info for the command to be successful.
    Also, only network interfaces that exist in the same virtual network can be added to the same application security group. The application security group must exist in the same location as the network interface.
    Refer : https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface#add-to-or-remove-from-application-security-groups

    Kindly let us know if the above helps or you need further assistance on this issue.

    ----------------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.