PowerShell: 101-vm-simple-linux


Very simple deployment of a Linux VM

Description

This is a conversion of ARM template 101-vm-simple-linux  from the repository azure\azure-quickstart-templates to PowerShell Script.

This script deploys a Linux VM Ubuntu using the latest patched version. This will deploy a Standard_B2s size VM and a 18.04-LTS Version as defaultValue in the resource group location and will return the admin user name, Virtual Network Name, Network Security Group Name and FQDN, and it will deploy the following resources…

… and in-addition to it, just in-case if the deployment is not successful, then it will rollback the entire deployment.

Note:

If there is already the specified resource group exists then the script will not continue with the deployment.

Syntax

Deploy-AzResources.ps1 [-resourceGroupName] <string> [-location] <string> [-adminUsername] <string> [[-authenticationType] <string>] [-adminPassword] <securestring> [[-KeyFileName] <string>] [-dnsLabelPrefix] <string> [[-ubuntuOSVersion] <string>] [<CommonParameters>]

Example

Deploy a linux VM with username and password

I 💙 PS> $param = @{
>> resourceGroupName = 'simple-rg'
>> location = 'westus'
>> adminUsername = 'sysadmin'
>> authenticationType = 'password'
>> dnsLabelPrefix = 'patnayakuni2020'
>> ubuntuOSVersion = '18.04-LTS'
>> }

I 💙 PS> .\Deploy-AzResources.ps1 @param

Output

cmdlet Deploy-AzResources.ps1 at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
adminPassword: *************
Deployment is successful!
HostName: patnayakuni2020.westus.cloudapp.azure.com

Code

    View the code in GitHub  
Last modified: 17 September 2020

 iac  
 linuxvm  
 vm  
Share it on     |   |   |   | 
comments powered by Disqus