Skip to content

Instantly share code, notes, and snippets.

@mikepfeiffer
Created March 9, 2020 18:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save mikepfeiffer/248956696c50e6add4b200f4fceef8f4 to your computer and use it in GitHub Desktop.
Save mikepfeiffer/248956696c50e6add4b200f4fceef8f4 to your computer and use it in GitHub Desktop.
Quick AZ PowerShell Script to Create a Web Server
param(
$Name = 'WEB1',
$Location = 'westus2',
$ResourceGroup = '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