Create/ Add a New NIC and Private IP Address to Existing Azure VM

Sharing is caring!

<div dir&equals;"ltr" style&equals;"text-align&colon; left&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi; mso-outline-level&colon; 2&semi;"><b><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 18&period;0pt&semi;">Create&sol; Add a New NIC and Private IP Address to Existing Azure VM<o&colon;p><&sol;o&colon;p><&sol;span><&sol;b><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">The first step is to open Windows PowerShell ISE and log in to your Azure subscription using the <b>Login-AzureRmAccount<&sol;b> cmdlet&period; Let’s define some variables for our VM&comma; network&comma; and other parameters that will be required&period;<o&colon;p><&sol;o&colon;p><&sol;span><br &sol;><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><br &sol;><&sol;span><&sol;p>&NewLine;<div style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><a href&equals;"http&colon;&sol;&sol;www&period;thecloudxperts&period;co&period;uk&sol;wp-content&sol;uploads&sol;2017&sol;10&sol;download-2B-25281-2529&period;jpg" style&equals;"margin-left&colon; 1em&semi; margin-right&colon; 1em&semi;"><img border&equals;"0" data-original-height&equals;"224" data-original-width&equals;"225" src&equals;"http&colon;&sol;&sol;www&period;thecloudxperts&period;co&period;uk&sol;wp-content&sol;uploads&sol;2017&sol;10&sol;download-2B-25281-2529&period;jpg" &sol;><&sol;a><&sol;div>&NewLine;<p><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><br &sol;><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;RG defines the Resource Group where the VM and VNET are located&period; The new NIC will be created in this Resource Group&period; I picked a name for the new NIC &lpar;&dollar;nicName&rpar;&comma; and a private IP address&comma; which I know is available &lpar;&dollar;ipAddress&rpar;&period; If you are not sure what the rest of the values should be for your deployment&comma; locate the VM in the Azure management portal&comma; and you’ll find information about the deployment&comma; network&comma; and any other related resources&period;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">2<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">3<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">4<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">5<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">6<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">7<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;vmName &equals; &OpenCurlyQuote;myVM’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;vnetName &equals; &OpenCurlyQuote;myVNET’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;RG &equals; &OpenCurlyQuote;PetriRG’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;subnetName &equals; &OpenCurlyQuote;Subnet-1’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;nicName &equals; &OpenCurlyQuote;PetriVM-NIC3’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;location &equals; &OpenCurlyQuote;North Europe’ <o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;ipAddress &equals; ’10&period;0&period;0&period;6’<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">The next step is to create an object for the VM using <i>Get-AzureRmVM<&sol;i>&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;myVm &equals; Get-AzureRmVM -Name &dollar;vmName -ResourceGroupName &dollar;RG<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">And now we’ll create an object for the virtual network using <i>Get-AzureRmVirtualNetwork<&sol;i>&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;vnet &equals; Get-AzureRmVirtualNetwork -Name &dollar;vnetName -ResourceGroupName &dollar;RG<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">The new NIC needs to be connected to a subnet &lpar;&dollar;subnetName&rpar;&comma; but we need to know the subnet ID before we can work with it in PowerShell&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;subnetID &equals; &lpar;Get-AzureRmVirtualNetworkSubnetConfig -Name &dollar;subnetName -VirtualNetwork &dollar;vnet&rpar;&period;Id<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Finally&comma; we can create a new NIC using the <i>New-AzureRmNetworkInterface<&sol;i> cmdlet&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">New-AzureRmNetworkInterface -Name &dollar;nicName -ResourceGroupName &dollar;RG -Location &dollar;location -SubnetId &dollar;subnetID -PrivateIpAddress &dollar;ipAddress<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Add a network interface in Azure &lpar;Image Credit&colon; Russell Smith&rpar;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi; mso-outline-level&colon; 2&semi;"><b><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 18&period;0pt&semi;">Attach the NIC to a VM<o&colon;p><&sol;o&colon;p><&sol;span><&sol;b><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Now that a new NIC has been created&comma; all that’s left to do is to attach it to the VM&period; First&comma; we’ll create an object for the NIC using the <i>Get-AzureRmNetworkInterface<&sol;i>cmdlet&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;myNIC &equals;&nbsp&semi;&nbsp&semi;Get-AzureRmNetworkInterface -Name &dollar;nicName -ResourceGroupName &dollar;RG<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Let’s add the NIC to the VM configuration&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;myVm &equals; Add-AzureRmVMNetworkInterface -VM &dollar;myVm -Id &dollar;myNIC&period;Id<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">If you want to check that the configuration has been changed to include the new NIC&comma; you can run the command below to see the list of NICs attached to the VM&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;myVM&period;NetworkProfile&period;NetworkInterfaces<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Note that the primary NIC &lpar;0&rpar; is the first NIC in the list&period; If you want to set another NIC as the primary NIC&comma; for instance&comma; the third NIC &lpar;2&rpar;&comma; run the command below&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">&dollar;myVM&period;NetworkProfile&period;NetworkInterfaces&period;Item&lpar;2&rpar;&period;Primary &equals; &dollar;true<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<div style&equals;"line-height&colon; normal&semi; mso-margin-bottom-alt&colon; auto&semi; mso-margin-top-alt&colon; auto&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Lastly&comma; let’s commit the new configuration using the <i>Update-AzureRmVM<&sol;i> cmdlet&colon;<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; 9&period;0pt&semi;"><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">PowerShell<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<table border&equals;"0" cellpadding&equals;"0">&NewLine;<tbody>&NewLine;<tr>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">1<o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<td style&equals;"padding&colon; &period;75pt &period;75pt &period;75pt &period;75pt&semi;">&NewLine;<div style&equals;"line-height&colon; normal&semi; margin-bottom&colon; &period;0001pt&semi; margin-bottom&colon; 0cm&semi;"><span style&equals;"background&colon; yellow&semi; font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;">Update-AzureRmVM -VM &dollar;myVm -ResourceGroupName &dollar;RG<&sol;span><span style&equals;"font-family&colon; &quot&semi;times new roman&quot&semi; &comma; &quot&semi;serif&quot&semi;&semi; font-size&colon; 12&period;0pt&semi;"><o&colon;p><&sol;o&colon;p><&sol;span><&sol;div>&NewLine;<&sol;td>&NewLine;<&sol;tr>&NewLine;<&sol;tbody>&NewLine;<&sol;table>&NewLine;<p><&sol;p>&NewLine;<div><&sol;div>&NewLine;<&sol;div>&NewLine;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.