Public/New-FaradayCage.ps1
#Create main function function New-FaradayCage { <# .Synopsis Creates a new resource group on Azure that simulates a air-gapped environment. .Description Creates a new resource group on Azure that simulates a air-gapped environment. It creates a Jumpbox, Firewall and Vnet .Parameter Name Name of the Resource Group and resources .Parameter Location Location of the Resource Group, ex: eastus .Parameter vm-username Username for the Jumpbox .Parameter vm-password Password for the Jumpbox .Parameter Linux Flag to create a Linux Jumpbox, Windows box is the defuault .Parameter Validate Flag to validate creation of Firewall .Example # Create new Faraday Cage New-FaradayCage .Example # Create a new Faraday Cage with MyFC located in West US New-FaradayCage -Name MyFC -Location westus .Example # Create a Faraday Cage with a Linux Jumpbox New-FaradayCage -Linux #> [CmdletBinding()] param( [Parameter(Mandatory)][string]$Name, [Parameter(Mandatory)][string]$Location, [Parameter(Mandatory)][string]${vm-username}, [Parameter(Mandatory)][string]${vm-password}, [switch]$Validate, [switch]$Linux ) ${secure-vm-password} = ConvertTo-SecureString ${vm-password} -AsPlainText -Force $NameSuffix = Build-Suffix -Name $Name -Location $Location $cred = New-Object System.Management.Automation.PSCredential ${vm-username}, ${secure-vm-password} #Call function to create resouce New-RGLocation -Name $Name -Location $Location -NameSuffix $NameSuffix | New-VirtualNetwork | New-JumpBox -cred $cred -Username ${vm-username} -Linux $Linux| New-Firewall | New-LogAnalyticsWorkspace | Write-CreatedResouces | Test-FirewallRule -Validate $Validate } |