diff --git a/InstallazKungfuVm.ps1 b/InstallazKungfuVm.ps1 new file mode 100644 index 0000000..ef6395d --- /dev/null +++ b/InstallazKungfuVm.ps1 @@ -0,0 +1,56 @@ +################################################################################# +# project: az-kung-fu +# http://www.build5nines.com/az-kung-fu +# MIT License - https://github.com/Build5Nines/az-kung-fu +################################################################################# +# Script Purpose +# - configure the az-kung-fu-vm +# Script Usage +# - custom script extention to configure the az-kung-fu-vm +# - manually configure the WSL ubuntu distro after provisioning +################################################################################## +#Install Chocolatey +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +#Assign Chocolatey Packages to Install +$Packages = ` + 'winrar', ` + 'git', ` + 'putty.install', ` + 'sysinternals', ` + 'github-desktop', ` + 'microsoft-edge', ` + 'visualstudiocode', ` + 'microsoftazurestorageexplorer' + +#Install Chocolatey Packages +ForEach ($PackageName in $Packages) +{ choco install $PackageName -y } + +#Todo - Install Azure PowerShell +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Set-ExecutionPolicy Bypass -Scope Process -Force; Install-Module -Name Az -AllowClobber -Scope AllUsers -Force + +#Install Azure CLI for Windows +Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet' + +#Enable WSL +Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart + +#Download and Install Ubuntu +Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile ~/Ubuntu.appx -UseBasicParsing +Add-AppxPackage -Path ~/Ubuntu.appx + +#User must manually configure WSL after reboot, see README.MD file +#Bring down Desktop Shortcuts +$zipDownload = "https://github.com/Build5Nines/az-kung-fu-vm/blob/shortcuts.zip?raw=true" +$downloadedFile = "D:\shortcuts.zip" +$vmFolder = "C:\Users\Public\Desktop" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Invoke-WebRequest $zipDownload -OutFile $downloadedFile +Add-Type -assembly "system.io.compression.filesystem" +[io.compression.zipfile]::ExtractToDirectory($downloadedFile, $vmFolder) + +#Reboot +Restart-Computer -Force \ No newline at end of file diff --git a/README.md b/README.md index 07aeda5..60512b3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,34 @@ -# az-kung-fu-vm -One click Azure Kung Fu VM +# Az Kung Fu - Adminstrator's VM! +Have you ever spent hours building a machine to use as a admin workstation for Azure? What about installing Windows Subsystem for Linux? Then this one click deployment is for you. Use this VM to start down the path of az-kung-fu grasshopper! + + + + + +**Software included on the VM** + +1. Office 365 Pro Plus +1. Azure Storage Explorer +1. Git for Windows (bash) +1. Microsoft Edge +1. Putty +1. SysInternals +1. Visual Studio Code +1. Windows Subsystem for Linux (Ubuntu 18.04) +1. WinRar + +**Creds** +1. User: Supplied on deploy +1. Password: Supplied on deploy + + +**Configure Windows Subsystem for Linux** +1. Double-click Install Ubuntu on Desktop, click Install. +1. Follow prompts to install providing UNIX username and password. +1. Run the following command to install the Azure CLI into WSL + +``` +sudo apt-get update -y && curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash +``` + +![alt text](https://github.com/build5nines/az-kung-fu-vm/blob/master/media/wsl.jpg "Configure Ubuntu for Windows") diff --git a/azure-deploy.json b/azure-deploy.json new file mode 100644 index 0000000..9ac82c3 --- /dev/null +++ b/azure-deploy.json @@ -0,0 +1,230 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "type": "string", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "dnsLabelPrefix": { + "type": "string", + "defaultValue": "[concat('az-kung-fu-', uniqueString(resourceGroup().id))]", + "metadata": { + "description": "Unique DNS Name for the Public IP used to access the Virtual Machine." + } + }, + "adminSourceIpAddress": { + "type": "string", + "defaultValue": "*", + "metadata": { + "description": "Enter your IP address, x.x.x.x/32 (use ipchicken.com to find this)" + } + } + }, + "variables": { + "azKungFuVmVnetName": "az-kung-fu-vm-vnet", + "azKungFuVmVnetPrefix": "192.168.0.0/24", + "azKungFuVmVnetSubnet1Name": "az-kung-fu-vm", + "azKungFuVmSubnet1Prefix": "192.168.0.0/24", + "azKungFuVmNsgName": "az-kung-fu-vm-nsg", + "azKungFuVmName": "az-kung-fu-vm", + "azKungFuVmImagePublisher": "MicrosoftWindowsDesktop", + "azKungFuVmImageOffer": "office-365", + "azKungFuVmWindowsOSVersion": "1903-evd-o365pp", + "azKungFuVmOSDiskName": "[concat(variables('azKungFuVmName'), '-OSDISK')]", + "azKungFuVmVmSize": "Standard_D4s_v3", + "azKungFuVmID": "[resourceId('Microsoft.Network/virtualNetworks', 'az-kung-fu-vm-vnet')]", + "azKungFuVmSubnetRef": "[concat(variables('azKungFuVmID'), '/subnets/', variables('azKungFuVmVnetSubnet1Name'))]", + "azKungFuVmNicName": "[concat(variables('azKungFuVmName'), '-nic')]", + "azKungFuVm-PUBIPName": "[concat(variables('azKungFuVmName'), '-pip')]", + "azKungFuVmInstallScriptFolder": ".", + "azKungFuVmInstallScriptFileName": "InstallazKungFuVm.ps1", + "azKungFuVmInstallURL": "https://raw.githubusercontent.com/Build5Nines/az-kung-fu-vm/master/InstallazKungfuVm.ps1" + }, + "resources": [ + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2019-09-01", + "name": "[variables('azKungFuVmNsgName')]", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "RDP", + "properties": { + "protocol": "TCP", + "sourcePortRange": "*", + "destinationPortRange": "3389", + "sourceAddressPrefix": "[parameters('adminSourceIpAddress')]", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 300, + "direction": "Inbound", + "sourcePortRanges": [ + ], + "destinationPortRanges": [ + ], + "sourceAddressPrefixes": [ + ], + "destinationAddressPrefixes": [ + ] + } + } + ] + } + }, + { + "name": "[variables('azKungFuVmVnetName')]", + "type": "Microsoft.Network/virtualNetworks", + "location": "[resourceGroup().location]", + "apiVersion": "2016-03-30", + "dependsOn": [ + ], + "tags": { + "displayName": "az-kung-fu-vm-vnet" + }, + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[variables('azKungFuVmVnetPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('azKungFuVmVnetSubnet1Name')]", + "properties": { + "addressPrefix": "[variables('azKungFuVmSubnet1Prefix')]" + } + } + ] + } + }, + { + "name": "[variables('azKungFuVm-PUBIPName')]", + "type": "Microsoft.Network/publicIPAddresses", + "location": "[resourceGroup().location]", + "apiVersion": "2017-10-01", + "dependsOn": [ + ], + "tags": { + "displayName": "azKungFuVm-PUBIP" + }, + "properties": { + "publicIPAllocationMethod": "Dynamic", + "dnsSettings": { + "domainNameLabel": "[parameters('dnsLabelPrefix')]" + } + } + }, + { + "name": "[variables('azKungFuVmNicName')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[resourceGroup().location]", + "apiVersion": "2017-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', variables('azKungFuVmVnetName'))]", + "[resourceId('Microsoft.Network/publicIPAddresses', variables('azKungFuVm-PUBIPName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', variables('azKungFuVmNsgName'))]" + ], + "tags": { + "displayName": "azKungFuVmNic" + }, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[variables('azKungFuVmSubnetRef')]" + }, + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('azKungFuVm-PUBIPName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('azKungFuVmNsgName'))]" + } + } + }, + { + "name": "[variables('azKungFuVmName')]", + "type": "Microsoft.Compute/virtualMachines", + "location": "[resourceGroup().location]", + "apiVersion": "2017-12-01", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkInterfaces', variables('azKungFuVmNicName'))]" + ], + "tags": { + "displayName": "azKungFuVm" + }, + "properties": { + "hardwareProfile": { + "vmSize": "[variables('azKungFuVmVmSize')]" + }, + "osProfile": { + "computerName": "[variables('azKungFuVmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[variables('azKungFuVmImagePublisher')]", + "offer": "[variables('azKungFuVmImageOffer')]", + "sku": "[variables('azKungFuVmWindowsOSVersion')]", + "version": "latest" + }, + "osDisk": { + "createOption": "FromImage", + "diskSizeGB": 2048 + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('azKungFuVmNicName'))]" + } + ] + } + }, + "resources": [ + { + "name": "InstallazKungFuVmApps", + "type": "extensions", + "location": "[resourceGroup().location]", + "apiVersion": "2017-12-01", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines', variables('azKungFuVmName'))]" + ], + "tags": { + "displayName": "Install azKungFuVm Applications" + }, + "properties": { + "publisher": "Microsoft.Compute", + "type": "CustomScriptExtension", + "typeHandlerVersion": "1.9", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "[variables('azKungFuVmInstallURL')]" + ], + "commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('azKungFuVmInstallScriptFolder'), '/', variables('azKungFuVmInstallScriptFileName'))]" + } + } + } + ] + } + ], + "outputs": { + } +} diff --git a/install-az-cli.sh b/install-az-cli.sh new file mode 100644 index 0000000..c11e16a --- /dev/null +++ b/install-az-cli.sh @@ -0,0 +1,29 @@ +#!/bin/bash +################################################################################# +# project: az-kung-fu +# http://www.build5nines.com/az-kung-fu +# MIT License - https://github.com/Build5Nines/az-kung-fu +################################################################################# +# Script Purpose +# - configure the az-kung-fu-vm +# Script Usage +# - Use this to install the azure cli manually if issues with script +# - for your az-kung-fu-vm. +################################################################################## +# Get packages needed for the install process +apt-get update +apt-get install ca-certificates curl apt-transport-https lsb-release gnupg + +# Download and install the Microsoft signing key +curl -sL https://packages.microsoft.com/keys/microsoft.asc | + gpg --dearmor | + sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null + +# Add the Azure CLI software repository +AZ_REPO=$(lsb_release -cs) +echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | + sudo tee /etc/apt/sources.list.d/azure-cli.list + +# Update repository information and install the azure-cli package +apt-get update +apt-get install azure-cli -y \ No newline at end of file diff --git a/media/wsl.jpg b/media/wsl.jpg new file mode 100644 index 0000000..8430117 Binary files /dev/null and b/media/wsl.jpg differ diff --git a/shortcuts.zip b/shortcuts.zip new file mode 100644 index 0000000..4307dbe Binary files /dev/null and b/shortcuts.zip differ