Powershell Script to create Subnet and Attach it to Virtual Network
Powershell Script to create Subnet and Attach it to Virtual Network(Part 2)
Virtual Network:
Virtual Network is Customer managed secure,isolated virtual network that can be configured in Azure. A Virtual Network is an interconnected networks or subnets . It is Network Virtualization
Some Key points need to keep in mind regarding VNET!!!
- Services and VMs that are part of same VNET can access each other
- Each VNET can have as many Subnets
- All VMs deployed within VNET can have access to internet
Lets Create a Virtual Network(VNET) in Azure:
Things needed:
- VNET Name
- ResourceGroup Name
- Location
- AddressPrefix
Subnet:
In simple word it is a Sub-Network ,Break up the Network for Manageable Section,All services can be accessed across subnet
Lets Create a Subnet in Azure :
Things we need for that :
- SubnetName
- Virtual Network
- Address Prefix
So First we do Silent login:
$RG="Osgroup"
$VNETName="OsgroupVnet"
$Subnet1="Os1"
$LOCATION="South Central US"
Select-AzureRmProfile -Path “login.json”
$VNET=New-AzureRmVirtualNetwork -Name $VNETName -ResourceGroupName $RG -Location $LOCATION `
-AddressPrefix 192.168.0.0/16
Add-AzureRmVirtualNetworkSubnetConfig -Name $Subnet1 -VirtualNetwork $VNET `
-AddressPrefix 192.168.1.0/24
Get-AzureRmVirtualNetwork -ResourceGroupName $RG -Name $VNETName
Thanks !!!! have a nice day
No comments:
Post a Comment