O'Reilly logo

Windows Server 2016 Automation with PowerShell Cookbook - Second Edition by Thomas Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The steps for the recipe are as follows:

  1. Define key variables
      $Locname = 'uksouth'          # location name
      $RgName  = 'packt_rg'         # resource group name
      $SAName  = 'packt100sa'       # Storage account name
      $NSGName = 'packt_nsg'        # NSG name
      $FullNet = '10.10.0.0/16'     # Overall networkrange
      $CLNet   = '10.10.2.0/24'     # Our cloud subnet 
      $GWNet   = '192.168.200.0/26' # Gateway subnet
      $DNS     = '8.8.8.8'          # DNS Server to use 
      $IPName = 'Packt_IP1'         # Private IP Address name
      $VMName = "Packt100"          # the name of the vm
      $CompName = "Packt100"        # the name of the VM host
  1. Just in case, log in to Azure and ensure the resource group and storage account exist:
       Login-AzureRmAccount 
       $RG = Get-AzureRmResourceGroup -Name $RgName ` -ErrorAction SilentlyContinue ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required