An Azure service that is used to provision Windows and Linux virtual machines.
You can use Azure PowerShell to quickly change the private IP addresses of specific ipconfig settings on your Azure Network Interface Card (NIC). Here's a script that will update only ipconfig3, ipconfig4, and ipconfig5 while leaving ipconfig1 and ipconfig2 unchanged.
# Define variables
$ResourceGroupName = "YourResourceGroup"
$NICName = "YourNIC"
$NewPrivateIPs = @{
"ipconfig3" = "192.168.20.3"
"ipconfig4" = "192.168.20.4"
"ipconfig5" = "192.168.20.5"
}
# Get the NIC
$NIC = Get-AzNetworkInterface -ResourceGroupName $ResourceGroupName -Name $NICName
# Update specific IP configurations
foreach ($ipconfig in $NewPrivateIPs.Keys) {
$NIC.IpConfigurations | Where-Object { $_.Name -eq $ipconfig } | ForEach-Object {
$_.PrivateIpAddress = $NewPrivateIPs[$ipconfig]
}
}
# Apply the changes
Set-AzNetworkInterface -NetworkInterface $NIC
Write-Host "Private IPs updated successfully."
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin