Skip to content

Instantly share code, notes, and snippets.

@cwhitmore88
Forked from mikepfeiffer/NewWebServer.ps1
Created March 15, 2020 20:19
Show Gist options
  • Save cwhitmore88/eae698b335e4b72004e6073d430ac5a1 to your computer and use it in GitHub Desktop.
Save cwhitmore88/eae698b335e4b72004e6073d430ac5a1 to your computer and use it in GitHub Desktop.
Quick AZ PowerShell Script to Create a Web Server
param(
$Name = 'cw-WEB1',
$Location = 'westus2',
$ResourceGroup = 'cw-WebServers'
)
New-AzResourceGroup -Name $ResourceGroup -Location $Location
$params = @{
Name = $Name
Location = $Location
ResourceGroup = $ResourceGroup
VirtualNetworkName = "$ResourceGroup-VNET"
SubnetName = "$ResourceGroup-Subnet"
SecurityGroupName = "$Name-NSG"
PublicIpAddressName = 'myPublicIp'
OpenPorts = 80
}
New-AzVm @params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment