Configure Static Internal IP for Azure VMs
Short answer
C Modify the VM properties in the Azure Management Portal to set the private IP allocation method to Static.
Question
You plan to migrate the application on Azure virtual machines (VMs). You have configured two VMs on a single subnet in an Azure virtual network.
You need to configure the two VMs with static internal IP addresses.
What should you do?
Key Takeaways
The AZ-104 exam tests Azure Resource Manager (ARM) concepts, making classic deployment cmdlets like Set-AzureStaticVNetIP invalid traps.
Assigning a static private IP address to an Azure VM requires modifying the network interface configuration in the Azure portal, as classic PowerShell cmdlets are deprecated. This guide clarifies the correct ARM deployment method for AZ-104.
Common mistake: Choosing the classic Set-AzureStaticVNetIP cmdlet (Option E) because it sounds correct for older exams, but it is deprecated and does not work for ARM VMs.
Expert Analysis
Why the Answer Is Correct
Option C is correct because in the Azure Resource Manager (ARM) model, you assign a static internal IP address by modifying the network interface properties via the Azure portal. While the option broadly says "VM properties," the setting is accessed through the VM's networking blade, which leads to the underlying NIC configuration where the private IP allocation method is set to Static.
Why the Other Options Are Wrong
Option A (New-AzureRMVMConfig) is used to create a local VM configuration object, not to update an existing VM's IP configuration. Option B (Set-AzureSubnet) is not a valid cmdlet for configuring a static IP on a VM. Option D is incorrect because changing IP settings inside the Windows guest OS via Network and Sharing Center will break Azure networking. Option E (Set-AzureStaticVNetIP) is a deprecated Azure Service Management (Classic) cmdlet and does not apply to ARM VMs.
Community Comment Notes
Multiple commenters point out that Option E is a legacy cmdlet for Classic VMs, as DT95 noted, "E is wrong in 2024. The Set-AzureStaticVNetIP cmdlet is part of the classic (ASM) PowerShell module". While jellybiscuit correctly observes that "static IP settings are on the network interface, not the virtual machine," Option C remains the closest valid ARM-based method among the choices, assuming "VM properties" implies the networking properties accessed through the VM blade.
Official Reference
This link opens the official vendor documentation in a new tab.
Exam Strategy
For AZ-104, always eliminate any options using Azure Service Management (ASM) cmdlets like Set-Azure* without the Az prefix, as the exam strictly tests Azure Resource Manager (ARM) deployments.
Discussion 109 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 30 of 109
-
blackmetalx 👍 39Set-AzureStaticVNetIP is for Classic VMs and will be retired on September 1, 2023. For new VM it can be don in the portal or using Powershell: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-network-interface #Add/Change static IP. This process will change MAC address $vnet = Get-AzVirtualNetwork -Name $VNET -ResourceGroupName $ResourceGroup $subnet = Get-AzVirtualNetworkSubnetConfig -Name $subnet -VirtualNetwork $vnet $nic = Get-AzNetworkInterface -Name $NetInter -ResourceGroupName $ResourceGroup #Remove the PublicIpAddress parameter if the VM does not have a public IP. $nic | Set-AzNetworkInterfaceIpConfig -Name ipconfig1 -PrivateIpAddress $PrivateIP -Subnet $subnet -PublicIpAddress $publicIP -Primary $nic | Set-AzNetworkInterface
-
Quantigo 👍 24Correct Answer E: Run the Set-AzureStaticVNetIP PowerShell cmdlet.
-
jellybiscuit 👍 12You could use the portal, but static IP settings are on the network interface, not the virtual machine.
-
DT95 👍 7 Answered CE is wrong in 2024. The Set-AzureStaticVNetIP cmdlet is part of the classic (ASM) PowerShell module (Azure), which is deprecated. Answer is C: $nic = Get-AzNetworkInterface -Name <NIC_Name> -ResourceGroupName <Resource_Group> $nic.IpConfigurations[0].PrivateIpAllocationMethod = 'Static' $nic.IpConfigurations[0].PrivateIpAddress = '<Desired_IP_Address>' Set-AzNetworkInterface -NetworkInterface $nic
-
justjeroen 👍 7The answer here is E but it is already legacy. Now you should do with Set-AzNetworkInterfaceIpConfig
Show 25 more comments
-
Anonymouse1312 👍 7 Answered Cold question, nnow its C or Set-AzNetworkInterface
-
Axial30z 👍 6Adrien, in this case, I believe the correct answer is E I also thought C initially but when you read the option, it says 'Modify the VM properties'. You can't configure the static ip from the properties blade of the VM. Also following your link ref https://docs.microsoft.com/en-us/azure/virtual-network/ip-services/virtual-networks-static-private-ip-arm-pportal To use the portal means going through the following steps which is not the VM properties VM>Settings.Networking Select NIC>Settings.IP Configuration Select NIC and change assignment
-
7bc6163 👍 5 Answered CTo configure static internal IP addresses for Azure VMs in the Resource Manager model, modify the NIC properties in the Azure Portal. This ensures the IP address is managed correctly by Azure and avoids conflicts.
-
Snownoodles 👍 5Set-AzureStaticVNetIP is for 'legacy resource" Correct method:Portal->VM->Networking->Network interface->IP configuration
-
josevirtual 👍 5 Answered ESet-AzureStaticVNetIP is correct, although an updated answer might be Set-AzNetworkInterface
-
GoldBear 👍 5The answer is now C and E. You can use the Portal or Powershell to make this change.
-
rhanielcb23 👍 5Set-AzureStaticVNetIP PowerShell cmdlet Correct answer E.
-
EmnCours 👍 4 Answered ESpecify a static internal IP for a previously created VM If you want to set a static IP address for a VM that you previously created, you can do so by using the following cmdlets. If you already set an IP address for the VM and you want to change it to a different IP address, you'll need to remove the existing static IP address before running these cmdlets. See the instructions below to remove a static IP. For this procedure, you'll use the Update-AzureVM cmdlet. The Update-AzureVM cmdlet restarts the VM as part of the update process. The DIP that you specify will be assigned after the VM restarts. In this example, we set the IP address for VM2, which is located in cloud service StaticDemo. Get-AzureVM -ServiceName StaticDemo -Name VM2 | Set-AzureStaticVNetIP -IPAddress 192.168.4.7 | Update-AzureVM
-
tsummey 👍 4 Answered CIf this question is still on the test, the answer today would be C. You can log in to the portal, select the VM, then Networking followed by Network Settings. There is a box named 'Network Interface / IP Configuration' with a link. If you click on the link, you can change the associated IP to static. The PowerShell command 'Set-AzureStaticVNetIP' is still available in PowerShell: PS C:> Find-Command -Name Set-AzureStaticVNetIP Name Version ModuleName Repository ---- ------- ---------- ---------- Set-AzureStaticVNetIP 5.3.1 Azure PSGallery However, when I tried to use the cmdlet after verifying it's available, the result was: 'Set-AzureStaticVNetIP : The term 'Set-AzureStaticVNetIP' is not recognized as the name of a cmdlet, function, script file, or operable program.' That's just what I see today.
-
RVivek 👍 4 Answered CSet-AzureStaticVNetIP The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement. https://learn.microsoft.com/th-th/powershell/module/servicemanagement/azure/set-azurestaticvnetip?view=azuresmps-4.0.0
-
Doman01 👍 4C is correct https://imgur.com/a/d118T7K You can also read how to do it here It is also shown here https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/virtual-networks-static-private-ip-arm-pportal E is not correct due to this: https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/virtual-networks-static-private-ip-arm-ps
-
JWS80 👍 4E: Is correct however the command is no longer accurate. Set-AzNetworkInterface is the new command. C: You cannot change from dynamic to static in properties. In the portal go to your Virtual Machine, select networking, Select the Network Interface, Ip configurations, then the ipconfig at the bottom, where you can change it from dynamic to static
-
23169fd 👍 4 Answered Cthe correct way to set a static internal IP address for Azure VMs is either by modifying the VM properties in the Azure Management Portal (Option C) or using the appropriate ARM-based PowerShell cmdlets (Set-AzNetworkInterfaceIpConfig), but not Set-AzureStaticVNetIP, which is deprecated for ARM deployments.
-
HartMS 👍 4 Answered CIn VM settings, we need to go to Networking to make the required changes. C is the correct answer. Set-AzureStaticVnetIP is not a valid option, as that cmdlet was part of the classic model, which is now deprecated. The correct cmdlet is Set-AzNetworkInterface.
-
NaoVaz 👍 4 Answered ESet-AzureStaticVNetIP - "Sets the static VNet IP address information for a virtual machine object." (https://docs.microsoft.com/en-us/powershell/module/servicemanagement/azure.service/set-azurestaticvnetip?view=azuresmps-4.0.0)
-
flaviobrf 👍 4 Answered CThe Set-AzureStaticVNetIP just works for classic, for new Vms its can be done straight in the Portal console: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-network-interface
-
AzureLearner76 👍 4 Answered EAnswer should be E but its really shocking since this is from the service management days (classic) not the resource manager , pointless question
-
rawrkadia 👍 4Are the pre AZ/ARM cmdlets and management paradigm even on the exam?
-
ppp131176 👍 4E is correct:
-
kklohit 👍 3 Answered EYour company has two on-premises servers named SRV01 and SRV02. Developers have created an application that runs on SRV01. The application calls a service on SRV02 by IP address. You plan to migrate the application on Azure virtual machines (VMs). You have configured two VMs on a single subnet in an Azure virtual network. You need to configure the two VMs with static internal IP addresses. What should you do? A. Run the New-AzureRMVMConfig PowerShell cmdlet. B. Run the Set-AzureSubnet PowerShell cmdlet. C. Modify the VM properties in the Azure Management Portal. D. Modify the IP properties in Windows Network and Sharing Center. E. Run the Set-AzureStaticVNetIP PowerShell cmdlet
-
Linso 👍 3 Answered EExplanation To configure static internal IP addresses for Azure VMs, you must reserve the IP within the Azure virtual network, not inside the guest OS. Azure controls IP allocation through the virtual network configuration, so setting the IP address inside Windows Network settings can cause connectivity issues. The correct approach is to assign the static private IP through Azure, which ensures the address remains fixed for the VM. Why Option E is Correct Set-AzureStaticVNetIP assigns a static private IP address to an Azure VM within its subnet. Example:Set-AzureStaticVNetIP -VM $vm -IPAddress 10.0.0.5
-
3c5adce 👍 3C. Modify the VM properties in the Azure Management Portal. This is the best option because it allows you to configure static internal IP addresses for the VMs directly through the Azure Management Portal, providing a user-friendly interface and ensuring the changes are correctly applied within the Azure environment. This method is effective and integrates seamlessly with other Azure services and configurations.
-
jellybiscuit 👍 3It would work to start with. The problem is that the network interface in Azure would still be set to DHCP. If anything ever causes that IP to change, the server will be completely inaccessible (because you don't have console access).
-
MackD 👍 3Correct answer is currently not applicable anymore. It should be Set-AzNetworkInterface See: https://learn.microsoft.com/en-us/powershell/module/az.network/set-aznetworkinterface?view=azps-12.4.0
-
Azure_daemon 👍 3the correct answer is E, if you want to choose the portal, you have to find the interface of the VM and change the dynamic private IP to static, not the VM properties, so C is wrong
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All AZ-104 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AZ-104 Practice Test →