Implement Solutions that Use Virtual Machines Flashcards

1
Q

Virtual Machine Components

A
  • Resource Group
  • VM Size
  • Network
  • Images
  • Virtual Disk/Storage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Azure Virtual Machine Main Creation Methods

A
Azure Portal
Azure CLI
Azure PowerShell with AZ module
Azure ARM templates
(APIs also exist)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Basic Details needed to Create a Virtual Machine (in the Azure Portal)

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Azure Spot Instance

A

Setting that allows Azrue to stop and deallocate a virtual machine if Azure needs compute capacity back for whatever reason.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Linux alternative to VM Admin Username Password

A

SSH Public Key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Public Inbound Ports - Azure Portal

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Availability Options for Azure VM

A

No Infrastructure redundancy required,
Availability Zone
Availability Set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Reasons to Deploy VMs with code in Azure

A
  • Add consistency to your deployments and VM creation
  • Any production system should be implemented using automation
  • Construct similar down-level environments such as DEV/TEST
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Tools for Programmatic VM Creation

A

Azure CLI
Azure PowerShell
ARM Templates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Steps to create VM programmatically

A
  1. Create Resource Group (or choose existing resource group)
  2. Execute command to create Virtual Machine w/parameters
  3. Ensure Networking is correct - Remote Access Port may need to be Open, application ports may need to be open, etc.
    -can also add rules to the network security group directly to control access to this VM based on ports & IP addresses
    (recommended)
  4. Retrieve Public IP address to connect
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Azure CLI Create Resource Group Command

A

az group create –name “resource group name” \

–location ‘“location”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create VM Azure CLI command

A

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-username “username” \
  • -admin-password “password

Admin options 2:

  • -admin-username “username” \
  • -authentication-type “ssh” \
  • -ssh-key-value “path-to-key-value”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Default VM Size if Not specified

A

Standard Ds1 v2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Enable Remote Access w/ Azure CLI

A

az vm open-port

  • -resource-group “rg-name” \
  • -name “vm-name” \
  • -port “port to open number”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Get VM public address via Azure CLI

A

az vm list-ip-addresses \

  • -resource-group “resource group name” \
  • -name “vm name” \
  • -output table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What type of Object must be created in Azure Powershell to hold username/password for a local admin on a VM?

A

PSCredential

example script:
$username =’username’
$password = ConvertTo-SecureString ‘somepassword’ -AsPlainText -Force
$WindowsCred = New-Object System.Management.Automation.PSCredential ($username, $password)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Create New VM in Azure PowerShell Command

A

New-AzVM

  • ResourceGroupName $resource GroupName
  • Name $VM Name
  • Image $imageName
  • Credential $WindowsCred
  • OpenPorts 99999

(Minimum info needed)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which of these methods of VM creation can specify open ports at VM Creation?

Azure CLI
Azure PowerShell

A

Azure PowerShell

Using the -OpenPorts parameter of New-AzVm command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Get Azure VM Public IP address via PowerShell Command

A

Get-AzPublicIpAddress

  • ResourceGroupName ‘rg-name’
  • Name ‘vm-name’

Can add pipe to the end to get only ipaddress property :

… | Select-Object IpAddress

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

PowerShell Command to Log In to Azure

A

Connect-AzAccount -SubscriptionName ‘your sub name’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

PowerShell Command to point to correct subscription

A

Set-AzContext -SubscriptionName ‘sub-name’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Azure Powershell Create Resource Group Command

A

New-AzResourceGroup

  • Name ‘rg-name’
  • Location ‘location’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Why Use IaaS solutions over PaaS solutions?

A

Higher level of control when deploying the infrastructure needed for your application

24
Q

True or False: In Azure VMs, Azure manages administrative tasks related to a VM’s operating system such as installing OS upgrades or patches.

A

False, Azure provides underlying hardware on configuration for machine to run correctly, but you still need to manage the VM administrative task

25
Q

VM Quota Limit

A

20 VMs per Region Per Subscription (soft limit)

26
Q

What does a VM’s size property control?

A

Resources assigned to the VM:

  • amount of memory
  • processing power,
  • number of virtual network interface cards allowed
  • Total storage capacity available for VM
27
Q

What is a VM Extension?

A
Extensions enable you to automate some tasks or configuration once deployment of a VM completes successfully. 
Examples of extensions:
-Run custom scripts
-Deploy and manage configs
-Collect diagnostic data
28
Q

Method that creates a Resource Group in C#

A

azure.ResourceGroups.Define(groupName).WithRegion(Location).Create();

29
Q

Method to create Virtual Network in C# using Azure SDK

A
azure.Networks.Define(vnetName)
.WithRegion(location)
.WithExistingResourceGroup(resourceGroupName)
.WithAddressSpace(vnetAddress)
.WithSubnet(subnetName, subnetAddress)
.Create();
30
Q

Method to create Network Interface for a VM in C# SDK

A
azure.NetworkInterfaces.Define(niName)
.WithRegion(location)
,WithExistingResourceGroup(rgName)
.WithExistingPrimaryNetwork(network)
.WithSubnet(subnetName)
.WithPrimaryPrivateIPAddressDynamic()
.Create()

//network => created from the azure.Networks.Define() command

31
Q

In relation to a VM, what does a Virtual Network do?

A

Allows Communication with the rest of the world

32
Q

In relation to a VM, what is the significance of the Network Interface?

A

The network interface is used to connect to the virtual network to send/receive information

33
Q

Method that creates a VM in C# SDK

A
azure.VirtualMachines.Define(vmName)
.WithRegion(location)
.WithExistingResourceGroup(rgName)
.WithExistingPrimaryNetworkInterface(nic)
.WithLatestWindowsImage(params)
.WithAdminUsername(username)
.WithAdminPassword(password)
.WithComputerName(vmName)
.WithSize(VirtualMachineSizeTypes.SomeValue)
.Create();

//nic = created via azure.NetworkInterfaces.Define()….

34
Q

In relation to VMs, what does an Availability Set do?

A

Ensure that any VM in the same availability set is not placed on the same hardware.

35
Q

What is the point of an Availability Set?

A

If you have multiple Availability Sets, VMs will not be restarted at the same time because of software upgrades to a server.
Provides high availability.
Allows load balancing.

36
Q

True or False: You can only add your VM to an availability set at creation time.

A

True - If you forget to add a VM to an availability set, you must delete the VM and start over to assign it.

37
Q

True or False: Your VM instances must be in Availability Sets in order to load balance them

A

True

38
Q

What is an ARM template?

A

JSON file that defines what resources you want deployed in Azure with their configurations

39
Q

True or False: ARM templates are only used to deploy VMs in Azure

A

False: ARM Templates can be used to create ANY resource

40
Q

Can you reuse the same ARM template for different environments? If so, how? If not, why?

A

Yes, you can use the same ARM template for multiple environments by making use of template parameters to customize each environment at deployment time

41
Q

What does ARM stand for?

A

Azure Resource Manager

42
Q

What does Azure Resource Manager convert the JSON formatted ARM template into upon receiving?

A

REST API operations

43
Q

What methods can you use to deploy an ARM template?

A
Azure Portal
Azure CLI
PowerShell with the Az Module
REST API
Azure Cloud Shell
44
Q

What is the $schema in an ARM Template?

A

The location of the JSON schema file that describes the template’s language
Example: https://schema.management.azure.com/schemas/2019-04-01/.deploymentTemplate.json#

45
Q

What is the contentVersion of an ARM template?

A

The version of the template, as defined by the user

Useful for version controlling templates

46
Q

What is the apiProfile of an ARM template for?

A

versioning of resource types that are defined within your template

47
Q

What is the parameters section of an ARM template used for?

A

To provide values during deployment so that the same template is reusable across environments

48
Q

What is the ‘variables’ section in an ARM template used for?

A

To define values that are reused in your template and often constructed from parameter values

49
Q

What is the ‘functions’ section of an ARM Template used for?

A

Allows you to create custom functions that simplify templates
Ex: generate resource name based on environment deploying into

50
Q

What is the ‘resources’ section of an ARM template used for?

A

To specify the items you want to deploy such as VMs, storage accounts, networking elements, etc

51
Q

What is the ‘outputs’ section of an ARM template for?

A

Typically return values from deployed resources in the template for inspection

52
Q

Where can you download an ARM template automatically created from a step by step configuration of a VM

A

In the Azure Portal, you can use the Create function within Virtual Machines and follow the prompts. Then, on review + create, the template will be validated and instead of clicking ‘Create’, you can choose the option to download a template.

The generated template will contain necessary parameters as well.

53
Q

How is a parameter defined in the ARM template?

A

“my-param-name” : {
“type”: “my-param-type”
}

54
Q

How is a parameter set in the parameter JSON file for an ARM template

A
"parameters": {
     "my-param-name" : {
            "value":"my-param-value"
      }, ......
}

Parameter value can also be an array or object or array of objects

55
Q

Can a variable use another variable in an ARM template?

A

No

56
Q

How do you call a variable in an ARM template?

A

[variables(‘your-variable-name’)]

57
Q

What is the command to deploy with an ARM template in PowerShell?

A

New-AzResourceGroupDeployement

  • Name ‘deployName’
  • ResourceGroupName ‘rg-name’
  • TemplateFile ‘path-to-template-file’
  • TemplateParameterFile ‘path-to-template-param-file’