Testing new text format

Sure! Below is a PowerShell script to create a hub virtual network and two spoke virtual networks in Azure:

 

“`powershell

# Variables

$resourceGroupName = “YourResourceGroupName”

$location = “YourAzureRegion”

$hubVnetName = “HubVnet”

$spokeVnet1Name = “SpokeVnet1”

$spokeVnet2Name = “SpokeVnet2”

$hubVnetAddressPrefix = “10.0.0.0/16”

$spokeVnet1AddressPrefix = “10.1.0.0/16”

$spokeVnet2AddressPrefix = “10.2.0.0/16”

 

# Create the hub virtual network

New-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $hubVnetName -Location $location -AddressPrefix $hubVnetAddressPrefix

 

# Create the first spoke virtual network

New-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $spokeVnet1Name -Location $location -AddressPrefix $spokeVnet1AddressPrefix

 

# Create the second spoke virtual network

New-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $spokeVnet2Name -Location $location -AddressPrefix $spokeVnet2AddressPrefix

“`

 

Replace the placeholder values (`YourResourceGroupName` and `YourAzureRegion`) with your desired resource group name and Azure region. The script will create three virtual networks: one hub virtual network and two spoke virtual networks, each with their respective address prefixes.

 

Note: Make sure you have the Azure PowerShell module installed and authenticated to your Azure account before running the script.

Leave a Reply

Your email address will not be published. Required fields are marked *