Penetration tesing infrastructure as a code
Based on https://www.terraform.io/docs/providers/azurerm/r/virtual_machine.html
OS - Ubuntu
Terraform installed, path to terraform executable exists within PATH OS variable.
Create service principal in Azure subscription
Edit env.sh and replace SUBSCRITION ID, App ID, PASSWORD, TENANT_ID with obtained values.
./env.sh
terraform init
terraform apply -var="var1=val1" -var="var2=val2"
Name | Default value | Description |
---|---|---|
allowednet | all networks | IPv4 CIDR network address (or single IP) allowed co connect to public IP |
srvcount | 1 | amount of VMs to be created |
prefix | "pentesting" | prefix which will be used in all names including resource group and tags |
location | "westus2" | location for resources, can be obtained by az account list-locations --query '[].{Name.name}' |
vmsize | "Standard_DS1_v2" | VM size, can be obtained by az vm list-sizes --location LOCATION --query '[].{Name:name}' in chosen LOCATION |
sku | "18.04-LTS" | SKU for Ubuntu from Canonical, can obtained by az vm image list -p Canonical -f UbuntuServer --query '[].{SKU:sku}' |
admin_keydata | my public key | PUBLIC SSH key of admin user to be created in OS |
admin_username | "malipek" | username of admin user to be created in OS |