What do you someone breaks something? I post the solution here...

Kubernetes (K8s/K3d) / Terraform / Ansible / Linux / AWS / Docker / Bash / Python / ELK / CI/CD / Java / Traefik / Nginx / CentOs / Ubuntu


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!!!


  1. Services and VMs that are part of same VNET can access each other 
  2. Each VNET can have as many Subnets 
  3. All VMs deployed within VNET  can have access to internet

Lets Create a Virtual Network(VNET) in Azure:
      Things needed:

  1. VNET Name
  2. ResourceGroup Name
  3. Location
  4. 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 :
  1. SubnetName
  2. Virtual Network 
  3. 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:

Powered by Blogger.