Search This Blog

Sunday, January 29, 2023

New-AzResourceGroup -Name $rgName -Location $location

(Get-AzLocation).Location


 $location = '[Azure_region]'


 $location = 'westus'


 $rgName = 'az104-06-rg1'


 New-AzResourceGroup -Name $rgName -Location $location




New-AzResourceGroupDeployment `

   -ResourceGroupName $rgName `

   -TemplateFile $HOME/az104-06-vms-loop-template.json `

   -TemplateParameterFile $HOME/az104-06-vms-loop-parameters.json


$rgName = 'az104-06-rg1'

$location = (Get-AzResourceGroup -ResourceGroupName $rgName).location

$vmNames = (Get-AzVM -ResourceGroupName $rgName).Name


foreach ($vmName in $vmNames) {

  Set-AzVMExtension `

  -ResourceGroupName $rgName `

  -Location $location `

  -VMName $vmName `

  -Name 'networkWatcherAgent' `

  -Publisher 'Microsoft.Azure.NetworkWatcher' `

  -Type 'NetworkWatcherAgentWindows' `

  -TypeHandlerVersion '1.4'

}


/subscriptions/95bb138a-c6ee-4589-b624-83cafa8149df/resourceGroups/az104-06-rg1/providers/Microsoft.Network/virtualNetworks/az104-06-vnet2


/subscriptions/95bb138a-c6ee-4589-b624-83cafa8149df/resourceGroups/az104-06-rg1/providers/Microsoft.Network/virtualNetworks/az104-06-vnet3


Install-WindowsFeature RemoteAccess -IncludeManagementTools


Install-WindowsFeature -Name Routing -IncludeManagementTools -IncludeAllSubFeature


Install-WindowsFeature -Name "RSAT-RemoteAccess-Powershell"


Install-RemoteAccess -VpnType RoutingOnly


Get-NetAdapter | Set-NetIPInterface -Forwarding Enabled


Get-AzResourceGroup -Name 'az104-06*'


Get-AzResourceGroup -Name 'az104-06*' | Remove-AzResourceGroup -Force -AsJob






No comments:

Post a Comment