Powershell with Azure : Network Interface Create and Add

Опубликовано: 02 Ноябрь 2024
на канале: Pachehra Talks
53
4

In this video we leaned how to create NIC and add to the VM
New-AzResourceGroup -Name "PS-RG" -Location "EastUS"

#creating Subnet config

$mySubnetFrontEnd = New-AzVirtualNetworkSubnetConfig -Name "mySubnetFrontEnd" `
-AddressPrefix "192.168.1.0/24"
$mySubnetBackEnd = New-AzVirtualNetworkSubnetConfig -Name "mySubnetBackEnd" `
-AddressPrefix "192.168.2.0/24"

#creating Vnet with above subnet config
$myVnet = New-AzVirtualNetwork -ResourceGroupName "PS-RG" `
-Location "EastUs" `
-Name "PS-Vnet" `
-AddressPrefix "192.168.0.0/16" `
-Subnet $mySubnetFrontEnd,$mySubnetBackEnd

creating NIC

$frontend = $myVnet.Subnets | where {$_.Name -eq "mySubnetFrontEnd" }
New-AzNetworkInterface -Name "NetworkInterface1" -ResourceGroupName "PS-RG" -Location "eastus" -SubnetId $frontend.ID

$vm = get-Azvm -resourcegroupname PS-RG -Name PS-VM

$nicID = (get-Aznetworkinterface -ResourceGroupName PS-RG -Name NetworkInterface1).Id
Add-AzVmnetworkinterface -vm $vm -id $nicID | update-Azvm -ResourceGroupName PS-RG







https://pachehra.blogspot.com/

   • Terraform with Azure : Count , length...  
   • Terraform with Azure : Workspaces  
   • Terraform with Azure : Variables & In...  
   • Terraform with Azure  Part-1  
   • Video  
   • Video  
   • AZ-300 Introductory Video  
   • AZ-300 Configure Diagnostics settings...  
   • AZ-300 Create Action Groups  
   • AZ-300 Alerts and baseline resources  

My name is Arun Pachehra and i am an IT Professional & a fitness enthusiast. Its been more than 12 years working with various technologies and now i am planning to share with you all. As per plan i am going to publish the entire Az 300 series first and if things would go as planned then a lot of stuff would come your way including Q&A , Production issues and various interesting stuff.