Virtual machine components Flashcards
What are the VM components?
deployed in a resource group
VM size
Network
Images- used to deploy
storage - virtual disk
How to create a VM?
Azure portal- can be used to create VMs
In code -Azure CLI, Azure Powershell, Azure ARM templates
Creating an Azure portal(elements)
Instance details - name, region
availability options - availability sets and availability zones
VM image- i.e. windows server image
size-
administrator account - username and password or SSH public key for Linux
Inbound port rules- public IP address- permit network access in the VM. open RDP to allow RDP access
Creating VM using code(reasons)
adds consistency to your deployment and VM creation
any production sys should be created using automation
construct similar down levels such as tests
creating VM using code
create resource group
create VM
ensure remote access port is open depend on remote access method
retrieve public ip address to access VM remotely
Creating a VM with Azure CLI
Create a resource group =>
az group create \
–name “psdemo-rg” \
–location “centralus”
Create VM =>
az vm create \
–resource-group “psdemo-rg” \
–name “psdemo-win-cli” \
–image “win2019datacenter” \
–admin-username “demoadmin” \
–admin-password “password123$%^&*”
enabling remote access with Azure CLI
az vm open-port \
–resource-group “psdemo-rg” \
–name “psdemo-win-cli” \
–port “3389”
For linux the port will be 22
Retrieve public ip address
az vm list-ip-addresses \
–resource-group “psdemo-rg” \
–name “psdemo-linux-cli”
Creating a VM with Azure PowerShell
create ps creadential to store username and password
$username = ‘demoadmin’
$password=’ConvertTo-SecureString ‘password123$%^&*’ -AsPlainText -Force
$WindowsCred = New-Object System.Management.Automation.PSCredential ($username, $password)
Create VM
New-AzVM `
-ResourceGroupName ‘rehema’ `
-Name ‘psdemo-win-az’ `
-Image ‘Win2019Datacenter’ `
-Credential $WindowsCred `
-OpenPorts 3389
Get public IP address
Get-AzPublicIpAddress `
-ResourceGroupName ‘rehema’ `
-Name ‘psdemo-win-az’ | Select-Object IpAddress
ARM Templates
JSON file that defines your resources
building block for deployment automation
templates are submitted to ARM for provisioning
export an ARM template in Azure portal or write your own
deploy from the quickstart template library
Deploying ARM Templates
Azure portal
Azure CLI
Powershell(AZ Module)
REST API
Azure cloud shell
ARM Template format
{
“$schema”: location of the json schema file,
“$contentVersion”:””,
“$apiprofile”
“$parameters”
“$variables”
“$functions”
“$resources”
“$outputs”:{}
}