Virtual Machine Components
Azure Virtual Machine Main Creation Methods
Azure Portal Azure CLI Azure PowerShell with AZ module Azure ARM templates (APIs also exist)
Basic Details needed to Create a Virtual Machine (in the Azure Portal)
Basic: Subscription Resource Group Details: VM Name Region Image - list available in your selected region (not required) Azure Spot Instance VM Size - list available in your selected region Administrative: Administrator Account Username* Administrator Account Password* *Linux Can Use Username/ Password OR SSH public key Inbound port rules: Public Inbound Ports Select Inbound ports - permits inbound access from any machine on the specified port.
Azure Spot Instance
Setting that allows Azrue to stop and deallocate a virtual machine if Azure needs compute capacity back for whatever reason.
Linux alternative to VM Admin Username Password
SSH Public Key
Public Inbound Ports - Azure Portal
Setting when creating Azure VM instance in the inbound port rules section
Default access outside the Virtual Network or the internet is not permitted
Selecting an inbound port creates a rule to allow ANY machine to access the selected port(s)
More granular rules available in ‘networking’ (specify IPs etc)
Availability Options for Azure VM
No Infrastructure redundancy required,
Availability Zone
Availability Set
Reasons to Deploy VMs with code in Azure
Tools for Programmatic VM Creation
Azure CLI
Azure PowerShell
ARM Templates
Steps to create VM programmatically
Azure CLI Create Resource Group Command
az group create –name “resource group name” \
–location ‘“location”
Create VM Azure CLI command
az vm create
–resource-group “resource-group-name” \
–name “name” \
–image “image -name” \
~admin option choice~
–size “size - default = standard ds1 v2”)
Admin options 1:
Admin options 2:
Default VM Size if Not specified
Standard Ds1 v2
Enable Remote Access w/ Azure CLI
az vm open-port
Get VM public address via Azure CLI
az vm list-ip-addresses \
What type of Object must be created in Azure Powershell to hold username/password for a local admin on a VM?
PSCredential
example script:
$username =’username’
$password = ConvertTo-SecureString ‘somepassword’ -AsPlainText -Force
$WindowsCred = New-Object System.Management.Automation.PSCredential ($username, $password)
Create New VM in Azure PowerShell Command
New-AzVM
(Minimum info needed)
Which of these methods of VM creation can specify open ports at VM Creation?
Azure CLI
Azure PowerShell
Azure PowerShell
Using the -OpenPorts parameter of New-AzVm command
Get Azure VM Public IP address via PowerShell Command
Get-AzPublicIpAddress
Can add pipe to the end to get only ipaddress property :
… | Select-Object IpAddress
PowerShell Command to Log In to Azure
Connect-AzAccount -SubscriptionName ‘your sub name’
PowerShell Command to point to correct subscription
Set-AzContext -SubscriptionName ‘sub-name’
Azure Powershell Create Resource Group Command
New-AzResourceGroup
Why Use IaaS solutions over PaaS solutions?
Higher level of control when deploying the infrastructure needed for your application
True or False: In Azure VMs, Azure manages administrative tasks related to a VM’s operating system such as installing OS upgrades or patches.
False, Azure provides underlying hardware on configuration for machine to run correctly, but you still need to manage the VM administrative task