Module 3 - Implementing Virtual Machines

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

6/1/2017 Module 3: Implementing virtual machines

Module 3: Implementing virtual machines

Contents:

Module Overview

Lesson 1: Overview of IaaS v2 virtual machines

Lesson 2: Planning for Azure Virtual Machines

Lesson 3: Deploying IaaS v2 virtual machines

Lab A: Creating IaaS v2 virtual machines in Azure

Lesson 4: Authoring Azure Resource Manager templates

Lesson 5: Overview of IaaS v1 virtual machines

Lab B: Deploying IaaS v2 virtual machines by using Azure Resource Manager
templates

Module Review and Takeaways

Module Overview

Virtual machines are the most flexible resources available for implementing a Microsoft Azure­
based solution for your organization. You can use Azure Virtual Machines to host customized
workloads and applications, implement network­infrastructure roles, or extend your on­
premises services into the cloud. This module introduces the fundamentals of Azure Virtual
Machines, and discusses the different ways in which you can deploy and manage them.

Objectives

After completing this module, you will be able to:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 1/62
6/1/2017 Module 3: Implementing virtual machines

• Explain Infrastructure as a Service (IaaS) version 2 (v2) virtual machines.

• Plan for Azure Virtual Machines.

• Deploy IaaS v2 virtual machines.

• Author Azure Resource Manager templates.

• Explain IaaS version 1 (v1) virtual machines.

Lesson 1: Overview of IaaS v2 virtual machines

The Azure Resource Manager implementation of virtual machines, virtual networks, and
storage offers a range of new capabilities. When you implement an IaaS v2 infrastructure by
using Azure Resource Manager, it provides you with a more robust virtual­machine
deployment and administration. This lesson explains IaaS v2 as it relates to virtual machines,
and it identifies the differences between IaaS v1 and IaaS v2.

Lesson Objectives
After completing this lesson, you will be able to:

• Describe the IaaS v2 virtual machines.

• Identify the differences between IaaS v1 and IaaS v2 virtual machines.

Demonstration: Preparing the environment
Perform the following tasks to prepare the demonstration and lab environment:

1. Launch Windows PowerShell as an administrator.

2. Run the Setup­Azure command.

3. Specify the module number, and then confirm your selection.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 2/62
6/1/2017 Module 3: Implementing virtual machines

Note: Important: The scripts that this course utilizes might delete objects in your
Azure subscription. Therefore, we recommend that you use a separate Azure
subscription for this course. Also, to avoid potential confusion, you should use a
dedicated Microsoft account that has not been associated with any other Azure
subscription.

The demonstrations and labs in this course use custom Windows PowerShell modules,
including Setup­Azure to prepare the environment, and Reset­Azure to perform clean­up
tasks afterwards. For this module, Setup­Azure removes any cached Azure subscription and
account information from the Azure PowerShell session.

Before you start, your instructor will decide which Azure region is closest to your classroom
location. You will need this information during the lab setup and the lab.

Start the MSL­TMG and 20533C­MIA­CL1 virtual machines, and then sign in to MIA­CL1
as Student with the password Pa$$w0rd. You should have provisioned a Microsoft Azure
subscription before the lab.

Demonstration Steps

1. Launch Windows PowerShell with Administrator privileges.

2. At the Windows PowerShell prompt, type the following command, and then press Enter:

Setup-Azure

3. At the prompt, type the module number, and then press Enter.

4. Confirm your selection, and then press Enter.

5. When prompted, sign in to your Azure subscription by using an account that is either its
Service Administrator or a Co­administrator.

6. If you have multiple Azure subscriptions, select the one you want to use for this module

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 3/62
6/1/2017 Module 3: Implementing virtual machines

7. When prompted, provide the number corresponding to the Azure region that you want to
use for the Azure services that this script creates and then press Enter. The script will
take about a minute to complete.

8. After the script completes, close the Windows PowerShell command prompt.

What are IaaS v2 virtual machines?

The Azure Resource Manager implementation of Azure IaaS includes compute, network, and
storage capabilities that provide a unique way to administer IaaS resources within Microsoft
Azure. You can implement this new version of IaaS (IaaS v2) by creating IaaS v2 virtual
machines using several methods: the Azure portal, Azure Resource Manager templates, Azure
command­line interface (Azure CLI), and the Azure Resource Manager cmdlets in Azure
PowerShell.

IaaS v2 allows you to integrate compute, storage, and network resources under Azure
Resource Manager. You can declare and define these resources individually, or as part of a
larger solution.

With IaaS v2 virtual machines, you can:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 4/62
6/1/2017 Module 3: Implementing virtual machines

Attach storage and network resources to a virtual machine, without using Azure Cloud
Services.

• Create orchestrated deployments with templates and Virtual Machines Extensions (VM
Extensions), including Custom Scripts, Desired State Configuration (DSC), Chef, and
Puppet.

• Define tags that you can use for virtual­machine administration and reporting activities.

• Implement role­based access control (RBAC) for fine­grained control over access to virtual­
machine resources and their administration.

Using templates

Templates can incorporate a wide set of Azure services in addition to IaaS resources, including
Web apps and SQL databases. When you use an Azure Resource Manager template, you can
define several resources and their relationship, and deploy that group of resources
automatically with the template. You will learn more about how to create and implement
templates later in this module.

Comparing IaaS v1 and IaaS v2 virtual machines

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 5/62
6/1/2017 Module 3: Implementing virtual machines

In comparison to IaaS v1 virtual machines created under the classic management model
(formerly known as Azure Service Management), the IaaS v2 capabilities under Azure
Resource Manager provide a significant change to implementation and management of virtual
machines and their associated infrastructure. The following table summarizes the management
model of IaaS v1 and IaaS v2 machines.

There are several API enhancements in Azure Resource Manager that provide significant
performance and functionality enhancements over the classic model, including:

• Support for large scale and parallel deployment of virtual machines.

• Support for up to three fault domains in availability sets. A fault domain is related directly to
a set of hardware within an Azure datacenter. Each fault domain has independent hardware­
­essentially, a separate rack­­so that you can host virtual machines across multiple racks,
eliminating single points of failure for a virtual machine.

• Changes to the Custom script extension that allow you to specify scripts from any publicly
accessible URL.

• Integration of the Azure Key Vault with virtual machines to store sensitive data and private
deployment information such as passwords.

• Exposure of network APIs that enable independent creation and assignment of network
resources such as network interfaces, load balancers, and virtual networks. These resources
are not dependent on a virtual machine, and you can reuse them in the deployment process
for other virtual machines or solutions.

IaaS v2 also introduces conceptual differences in the general IaaS model that change how you
create and manage IaaS resources. The following table identifies the primary differences
between the Azure Service Management model and the Azure Resource Manager model.

Item Azure Service Azure Resource Manager


Management

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 6/62
6/1/2017 Module 3: Implementing virtual machines

Management model Azure Service Management Azure Resource Manager enables you to treat virtual­


provides the application machine resources as independent objects that you can
programming interfaces (APIs) attach to other IaaS objects, such as a virtual­network
that enable virtual­machine adapter that you attach to a virtual machine. You can
infrastructure in the classic IaaS v1 manage these resources individually, or as logical units,
model. The IaaS v1 model uses the in resource groups. Resource groups are the primary
Azure Cloud Services as a logical grouping unit used for both the initial
container for virtual­machine implementation and management of a group of Azure
resources. You must attach a resources.
virtual machine and its resources to
a Cloud Service in Microsoft
Azure, and the Cloud Service
container is the primary
management point.

Azure Cloud Cloud Service is a mandatory Cloud Service does not exist.


Services for virtual container for virtual machines and
machines associated objects.

Availability sets You can achieve high availability by Availability sets also are available in Azure Resource


assigning an arbitrary availability Manager. The maximum number of fault domains that
set to a virtual machine. Virtual you can have is three.
machines that you assign to the
same availability set exist in
different fault domains, and the
maximum number of fault domains
that you can have is two.

Affinity groups You have the option of using Affinity groups do not exist.


affinity groups when defining
virtual networks.

Load balancing The Cloud Service object acts as a The load balancer is an independent resource. You can


load balancer for IaaS resources assign a network adapter that is attached to a virtual
within Azure Cloud Services. machine to a load balancer.

Virtual IP address The platform automatically assigns Public IP addresses can be static or dynamic. You


(VIP) a VIP to the Cloud Service upon its have the option of assigning a public IP to a network
creation. This address is associated adapter or a load balancer.
with the Cloud Service load
balancer.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 7/62
6/1/2017 Module 3: Implementing virtual machines

Reserved IP address You can reserve IP addresses in Static mode public IP addresses provide the same


Azure, and then associate it with a capability as reserved IP addresses.
Cloud Service to ensure a
consistent IP address.

Public IP address per You can assign public IP addresses You can assign public IP addresses to a network


virtual machine to a virtual machine directly. interface, which then can be assigned to a virtual
machine.

Endpoints Virtual machines are exposed to You can access virtual machines for management by


external network connectivity by using the public IP address for the virtual machine.
configuring input endpoints for the You can also expose virtual machines to external
Cloud Service to which the virtual network connectivity by configuring inbound network
machines belong. address translation (NAT) rules on a connected load
balancer.

DNS name You assign a Cloud Service a You can assign DNS names to public IP addresses by


Domain Name System (DNS) assigning a domain label. The fully qualified domain
name based on the name of the name (FQDN) includes the Azure region, such as:
Cloud Service, such as:
adatumvm1.eastus.cloudapp.azure.com.
adatumdev.cloudapp.net

Network interfaces You define the primary and Network interface is an independent resource that is


secondary network interfaces persistent in the Azure environment. You can attach it
within the configuration of a virtual to, and detach it from, virtual machines without losing
machine. its identity and configuration state. Its lifecycle might
not depend on the lifecycle of a virtual machine.

Creation and You can use the Classic Portal, the Use the Azure portal, Azure Resource Manager


management Azure Service Management templates, the Azure Resource Manager cmdlets in
cmdlets in Azure PowerShell, Azure PowerShell, the Azure CLI, or the Azure APIs.
Azure CLI, or the Azure APIs.

Lesson 2: Planning for Azure Virtual Machines

You can implement Azure Virtual Machines for several different reasons. You might be
implementing a new cloud­based service or application, moving an existing virtualized
infrastructure to Azure, or extending the scope of your on­premises network by using Azure
Virtual Machines. This lesson introduces you to the key considerations for implementing

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 8/62
6/1/2017 Module 3: Implementing virtual machines

Azure Virtual Machines, and it describes the methods to evaluate and migrate existing
workloads to Azure.

Lesson Objectives
After completing this lesson, you will be able to:

• Identify the workloads for Azure Virtual Machines.

• Describe the considerations for virtual machine sizing.

• Explain how to migrate workloads to Azure.

• Explain how to evaluate the use of Azure containers.

Identifying workloads for Azure Virtual Machines

Virtual machines can provide a wide variety of purposes and functionality in Azure. However,
while some workloads are suitable for deploying to virtual machines in Azure, others are not
and can be more challenging to deploy.

Suitable workloads for virtual machines in an Azure IaaS environment

Certain types of workloads are a better fit for hosting in an Azure IaaS environment, such as:
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 9/62
6/1/2017 Module 3: Implementing virtual machines

• Highly available service workloads, such as commercial online stores.

• Periodic workloads, such as:

o Complex data analysis of sales figures that an organization needs to run at the end
of each month.
o Seasonal marketing campaigns on an organization’s website.
o Annual retail sales spurts that may occur during festive holidays.

• Unpredictable growth workloads, such as those experienced by small, but rapidly
expanding, organizations, or by short­term increased sales of “fad” products.

• Spiking workloads, such as those experienced by sites that provide news services or
organizations that perform end­of­day reporting to a head office.

• Steady workload scenarios where organizations simply want to offload their infrastructure
to the cloud.

When you plan virtual­machine workloads for Azure IaaS, you should remember that not
every application or service is a suitable fit for the cloud.

Unsuitable workloads for virtual machines in an Azure IaaS environment

Some workload scenarios do not suit the elasticity and flexibility of an Azure IaaS
environment, such as:

• Low­volume or limited­growth workloads, in which an organization might run the service or
application on commodity hardware on­premises, which is less expensive than to run it in
the cloud.

• Regulated environment workloads where an organization or local government might regulate
the type of data that it can host in the cloud. However, these cases might be suitable
candidates for a hybrid solution, in which an organization hosts some highly available data
in Azure, and then keeps more sensitive, regulated data on­premises.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 10/62
6/1/2017 Module 3: Implementing virtual machines

IaaS virtual machines vs. PaaS solutions

It is important to evaluate Platform as a Service (PaaS) solutions that you could use in place
of some server roles and services that would run in an Azure virtual machine. For example,
you could replace a Windows Server 2012 R2 virtual machine that is running Internet
Information Services (IIS) to provide a web page with the Azure Web App service. This
requires less administration and maintenance, and provides a higher default level of availability
and scalability. The same considerations are true for SQL Server versus Azure SQL Database;
an Active Directory Domain Services (AD DS) domain controller versus Azure Active
Directory Domain Services; and a DNS server versus Azure DNS.

Software support for Azure IaaS virtual machines

You must ensure all Microsoft software that you install in the Azure virtual­machine
environment have proper licenses. By default, Azure Virtual Machines include a license that
allows you to use Windows Server in the Azure environment. Additionally, certain Azure
virtual­machine images might include licenses for additional Microsoft software, on a per­hour
or evaluation basis. You must obtain licenses for other software separately.

A wide range of Microsoft server software is supported in an Azure IaaS virtual machine
environment, including:

• Microsoft Forefront Identity Manager 2010 R2 Service Pack 1 (SP1) and newer versions

• Microsoft SharePoint Server 2010 and newer versions

• Microsoft SQL Server 2008 (64­bit) and newer versions

• Microsoft System Center 2012 SP1 and newer versions

The following table lists the roles that are supported currently in Windows virtual machines
and the roles that are not.

Supported Windows Server roles Unsupported server roles

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 11/62
6/1/2017 Module 3: Implementing virtual machines

• AD DS • Dynamic Host Configuration Protocol Server

• Active Directory Federation Services • Hyper­V

• Active Directory Lightweight Directory Services • Remote Access (Direct Access)

• Application Server • Rights Management Services

• DNS Server • Windows Deployment Services

• Failover Clustering

• File Services

• Network Policy and Access Services

• Print and Document Services

• Remote Access (Web Application Proxy)

• Remote Desktop Services

• Web Server (IIS)

• Windows Server Update Services

There also are some significant Windows Server features that are not currently supported:

• Internet Storage Name Service (iSNS) Server

• Multipath I/O

• Network Load Balancing

• Peer Name Resolution Protocol

• Simple Network Management Protocol (SNMP) Service

• Storage Manager for storage area networks (SANs)

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 12/62
6/1/2017 Module 3: Implementing virtual machines

• Windows Internet Name Service

• Wireless local area network (LAN) service

Azure Virtual Machines also support several Linux distributions, including CentOS, CoreOS,
Debian, Oracle Linux, Red Hat, SUSE, openSUSE, and Ubuntu.

Virtual machine sizing

When you create virtual machines in Azure, you can select from several available sizes and
options for the virtual machine­based compute resources that run your apps and workloads.
There also are deployment considerations that you need to be aware of when you plan to
provision or deploy these resources.

Virtual­machine sizes in Azure

Azure offers several virtual­machine size groups that offer different levels of compute
resources, including:

• A­series. Generally, use this size for general­purpose compute. A­series virtual machines are
for simple production workloads that are not memory­intensive and do not require load
balancing or auto­scaling.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 13/62
6/1/2017 Module 3: Implementing virtual machines

• D­series. Generally, use this size for optimized compute. The hardware configurations that
host D­series virtual machines have faster processors and solid­state drives for applications
that require higher performance.

• G­series. Use this size for performance­optimized compute. G­series virtual machines have
the highest level of compute resources in Azure, and can handle heavy workloads and
application demands.

• DS and GS series. These virtual machines are D­series and G­series machines that are for
Premium Storage in Azure specifically. You will learn more about Premium Storage later in
this course.

A­series virtual machines are available in two compute tiers­­Basic and Standard. The
Standard tier compute instances offer optimal compute, memory, and input/output (I/O)
resources, so that you can run a wide range of applications and workloads. These instances
include both auto­scaling, load balancing, and internal load­balancing capabilities at no
additional cost. Both types offer different sizes.

The Basic tier compute instances are similar to the higher­priced Standard tier, but the virtual­
machine instances do not include load­balancing or auto­scaling features. Basic tier VMs are
best suited to single­instance production applications, development workloads, test servers,
and batch­processing applications.

Additional Reading: For more information on virtual machine sizes, including any
changes since this course was published, refer to Sizes for virtual machines:
http://aka.ms/Iyrbvv

Sizing considerations

When determining sizing for your Azure Virtual Machines, you should consider the following:

• There are two tiers of Azure Storage for storing your virtual machine’s virtual disks:
Standard and Premium. Premium offers higher I/O throughput, but at a higher pricing level.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 14/62
6/1/2017 Module 3: Implementing virtual machines

• The size of the virtual machine affects the pricing, and the tier affects some capabilities.

• A1 is the smallest size that we recommend for production workloads.

• When deploying a virtual machine for SQL Server Enterprise Edition, select a virtual
machine with at least four CPU cores.

Virtual­machine limits in Azure

When creating IaaS v1 virtual machines in Azure, each cloud service in which those virtual
machines reside can contain a maximum of 50 virtual machines. When you create a new
virtual machine, a cloud service is created automatically to contain it, but you can add more
virtual machines in that same cloud service, up to the 50 virtual­machines limit. You also can
have a maximum of 150 input endpoints per cloud service. There is also a limit of 100 virtual
machines in each Azure availability set when you use Azure Resource Manager.

Additional Reading: For more information on virtual machine limits, including any
changes since this course was published, refer to Azure subscription and service limits,
quotas, and constraints: http://aka.ms/Shfw8w

The Microsoft Azure (IaaS) Cost Estimator Tool

This tool helps customers understand their existing on­premises infrastructure and estimate the
cost of running it on Azure. It helps to identify the utilization and resource allocation on
physical machines and guest virtual machines running on VMware and Hyper­V. It also
determines the cost of running an on­premises physical or virtual machine workload on Azure
over a 30­day period. The tool scans the hardware and resource utilization over a short period,
and typically completes within 15 minutes. The tool then matches the resulting server profile
against Azure IaaS instance types to determine the best fit based on cost or performance. You
also can export the results to Excel or to a CSV file.

The tool can scan any of the following machine types:

• Microsoft virtualization technologies (System Center Virtual Machine Manager, Hyper­V)
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 15/62
6/1/2017 Module 3: Implementing virtual machines

• VMware virtualization technologies (vSphere, ESXi)

• Physical infrastructure (Windows, Linux)

You can install the tool on any of the following operating systems:

• Windows Server 2012 and newer versions

• Windows Server 2008 R2 Service Pack 1 (SP1)

• Windows Server 2008 SP2

• Windows Vista SP2

• Windows 7 SP1

• Windows 8.1 and 8

• Windows 10

Additional Reading: To download the Microsoft Azure (IaaS) Cost Estimator tool,
refer to: http://aka.ms/Mg0mhu

Migrating workloads to Azure

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 16/62
6/1/2017 Module 3: Implementing virtual machines

You can migrate on­premises workloads to Azure by uploading the .VHD file to Azure and
attaching it to an Azure virtual machine. This allows you to take existing workloads that are
running on on­premises virtual machines and transfer them to virtual machines that are
running in Azure.

Considerations for using .VHD files for Azure Virtual Machines

You must upload a .VHD file to Azure Storage before you can attach it to the virtual machine,
and consider several factors, including that:

• .VHD files must be from Hyper­V virtual machines.

• .VHDX files are not supported as Azure virtual machine disks.

• If you are using the .VHD as an image to deploy Windows­based Azure Virtual Machines,
you must generalize the on­premises virtual machine by using sysprep.exe.

• The .VHD file must be a fixed­size virtual disk.

Uploading .VHD files

The following process lists the steps for uploading a .VHD file from a Windows­based virtual
machine to Azure for use as an image to deploy Azure Virtual Machines:

1. Generalize the virtual machine in Hyper­V by running sysprep.exe from the command
prompt.

2. In Sysprep, set the System Cleanup Action to Enter System Out­of­Box Experience
(OOBE) and ensure the Generalize check box is selected.

3. Shut down the virtual machine in Hyper­V.

4. Copy the .VHD file to an Internet­connected computer that has the Azure PowerShell
module installed.

5. In the Azure PowerShell window, type the following command, and then press Enter:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 17/62
6/1/2017 Module 3: Implementing virtual machines

Add-AzureRmVhd –ResourceGroupName –Destination


“<BlobStorageURL>/<ContainerName>/<VHDName>.vhd” –LocalFilePath
<PathtoVHDFile>

Where:

o BlobStorageURL is the URL for the storage account.
o ContainerName is the container within blob storage where you want to store your
images.
o VHDName is the name you want Azure to display to identify the virtual hard disk.
o PathToVHDFile is the full path and name of the .VHD file.

Evaluating the use of Azure containers

A container object in Azure provides a unique set of features that offers several benefits when
you are running certain workloads within Azure. In Azure, a virtual machine runs within a
virtualization environment enabled by using a hypervisor. You create virtual machines by
choosing and configuring the operating system for the virtual machine, or by using a custom
image. For the most part, virtual machines and the operating system that they run are isolated
from the host environment.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 18/62
6/1/2017 Module 3: Implementing virtual machines

Azure containers do not require a hypervisor to enable isolation. The container provides
limited exposure to certain outside components, by isolating the process and file system of the
host operating system, which is either Linux or Windows. In most cases, a container contains
an application or reusable service component that acts as part of a larger solution within
Azure. An application within a container sees the container as a unique operating­system
instance.

Containers are designed to:

• Increase the speed with which you can develop and share application code.

• Improve the testing lifecycle for applications.

• Improve the deployment process for applications.

In Azure, containers run within an Azure virtual machine, which provides the container that
hosts the environment, which is either Windows or Linux. You can use containers to replace
full virtual machines in many cases, especially when the virtual machine is hosting a
component of a distributed application.

Container benefits for IT pros

The combination of containers and virtual machines offers several benefits for developers, and
they also provide benefits for information technology (IT) professionals, including that:

• Services and applications within containers are isolated from the virtual machine host
execution environment.

• Contained code is verifiably identical.

• Developers can start, stop, and move services and applications that are in containers quickly
between development, test, and production environments.

Comparison of virtual machines and containers

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 19/62
6/1/2017 Module 3: Implementing virtual machines

The following table lists the high­level differences between virtual machines and containers.

Feature Virtual machines Containers

Security support Greater control of security mechanisms. Lesser control, but easier


implementation.

Memory required Required for complete operating system and Required for apps only.


apps.

Startup time Increased startup time. Boot of operating Lesser startup time. Only apps and


system, services, and apps. dependent services start. Kernel is
already running.

Portability Portable with proper configuration. More portable, typically smaller in


storage size.

Image automation Dependent on operating system and apps. Based on docker registry.

Additional Reading: For more information about containers, refer to:
http://aka.ms/Vrjd2j

Lesson 3: Deploying IaaS v2 virtual machines

You can deploy IaaS v2 virtual machines by using several methods within the Azure
environment. You can deploy single virtual machines by using the Azure portal interface,
automate the creation of virtual machines by using Azure PowerShell, or deploy large­scale
environments by using Azure Resource Manager templates. This lesson explains the primary
methods for creating IaaS v2 virtual machines, and it demonstrates these methods.

Lesson Objectives
After completing this lesson, you will be able to:

• Identify the methods to create IaaS v2 virtual machines.

• Explain how to use the Azure portal to create virtual machines.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 20/62
6/1/2017 Module 3: Implementing virtual machines

• Explain how to use Azure PowerShell to create virtual machines.

• Explain how to use Azure Resource Manager templates to create virtual machines.

• Create IaaS v2 virtual machines in Azure.

Creating IaaS v2 virtual machines

Azure Resource Manager provides several methods to create IaaS v2 virtual machines by
using different tools:

• Azure portal. You can use the Azure portal to create virtual machines on a one­by­one
basis. Creating virtual machines in the Azure portal is easy to do in the graphic interface,
but the portal does not provide the ability to create multiple virtual machines simultaneously
or automate the virtual machine creation process.

• Azure PowerShell. Azure PowerShell provides a complete set of cmdlets for creating and
configuring virtual machines using the Azure Resource Manager model. All Azure Resource
Manager cmdlets for virtual machine management are of the form Verb­AzureRmNoun. For
example, to create a new virtual machine, you would use the New­AzureRmVM cmdlet.

You can also use Azure PowerShell to deploy virtual machines using deployment templates.
Later sections of this module provide more detail about deployment templates.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 21/62
6/1/2017 Module 3: Implementing virtual machines

• Azure CLI. You can use the Azure CLI feature to create virtual machines. You can use the
CLI on Windows, Linux, and Mac operating systems. The Azure CLI has a complete set of
Azure Resource Manager commands that you can use, You can also use Azure Service
Management commands by switching the Azure CLI to Azure Resource Manager mode
with the following command:

azure config mode asm

To switch back to Azure Resource Manager mode, use the following command:

azure config mode arm

To create an Azure virtual machine using Azure Resource Manager mode, at the command
prompt, type the following command , and then press Enter. You will be prompted to type any
information necessary for virtual machine creation, such as virtual machine name, resource
group, and location:

Azure vm quick-create

Note: This is one way to create a virtual machine using the Azure CLI.

Using images to create virtual machines

You can use images to create Azure Virtual Machines. You can capture images from on­
premises virtual machines, or you can use pre­built images from the Azure Marketplace. The
Marketplace contains basic operating­system images and images that are built to provide a
specific purpose. The Marketplace contains hundreds of images in the following categories:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 22/62
6/1/2017 Module 3: Implementing virtual machines

• Microsoft Windows Server

• Numerous Linux distributions

• Database servers

• Application servers

Capturing images that Azure Virtual Machines can use

You can reuse Azure Virtual Machines that you configure to deploy images as new Azure
Virtual Machines. This process saves time when you are configuring new virtual machines by
reusing a configuration that exists already within an Azure virtual machine.

To capture an Azure virtual machine as an image for reuse in Azure, perform the following
steps:

1. Sign in to the virtual machine operating system, and then generalize the image by typing
the following command, and then pressing Enter:

Sysprep /oobe /generalize /shutdown

2. From the Azure PowerShell prompt, sign in to your Azure account.

3. Deallocate the resources of the virtual machine that you are capturing by using the
following command at the command prompt:

Stop-AzureRmVM –ResourceGroupName <ResourceGroupName> -Name


<CapturedVMName>

4. Set the status of the virtual machine that you are capturing to Generalize by using the
following command:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 23/62
6/1/2017 Module 3: Implementing virtual machines

Set-AzureRmVM –ResourceGroupName <ResourceGroupName> -Name


<CapturedVMName> -Generalize

5. Capture the virtual­machine image to an existing storage­account container by using the
following command:

Save-AzureRmVMImage -ResourceGroupName <ResourceGroupName> -


VMName <CapturedVMName> -DestinationContainerName
<StorageContainerName> -VHDNamePrefix <PrefixName>

Additional Reading: For more information about capturing and deploying virtual
machine images by using Azure Resource Manager, refer to: http://aka.ms/Cey939

Using the Azure portal to create virtual machines

To create an IaaS v2 virtual machine from the Azure portal, perform the following steps:

1. Sign in to the Azure portal at https://portal.azure.com.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 24/62
6/1/2017 Module 3: Implementing virtual machines

2. On the Hub menu, click New, click Compute, and then click Windows Server 2012 R2
Datacenter.

3. On the Windows Server 2012 R2 Datacenter page, under Select a deployment
model, select Resource Manager, and then click Create.

4. On the Create virtual machine blade, click Basics.

5. Enter the name that you want to give your virtual machine. The name cannot contain
special characters.

6. Enter the Windows administrative user name and password. The password must be at
eight to 123 characters long, and include at least three of the following: one lower­case
character, one upper­case character, one number, and one special character. You will
need the user name and password to sign in to the virtual machine.

7. If you have more than one subscription, specify the one for the new virtual machine, a
new or existing resource group, and an Azure datacenter location.

8. Click Size, and then select an appropriate virtual­machine size for your needs. Each size
specifies the number of compute cores, memory, and other features, such as support for
Premium Storage. These all affect the price. Azure recommends certain sizes
automatically, depending on the image that you choose.

9. Click Settings to see storage and networking settings for the new virtual machine. For a
test virtual machine, you typically can accept the default settings. If you select a virtual­
machine size that supports it, you can try out Premium Storage by selecting Premium
(SSD) under Disk type.

10. Click Summary to review your configuration choices. When you finish reviewing or
updating the settings, click Create.

As Azure creates the virtual machine, you can track the progress under Virtual Machines on
the Hub menu.

These steps use the image based on Windows Server 2012 R2 Datacenter Edition to create an
IaaS v2 virtual machine.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 25/62
6/1/2017 Module 3: Implementing virtual machines

Using Azure PowerShell to create virtual machines

You can use Azure PowerShell to create virtual machines from the Azure PowerShell
command prompt, or by using Azure PowerShell scripts. When you use Azure Resource
Manager cmdlets to create Azure Virtual Machines, you can take advantage of the RBAC and
group­management features that Azure Resource Manager provides.

To create an IaaS v2 virtual machine by using Azure PowerShell, perform the following steps:

1. Open the Azure PowerShell command prompt.

2. Sign in to Azure by typing the following cmdlet, and then pressing Enter:

Login-AzureRmAccount

3. Retrieve the Azure subscription name that you want to use by viewing the list of
subscriptions after typing the following command, and then pressing Enter:

Get-AzureRmSubscription | sort SubscriptionName | Select


SubscriptionName

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 26/62
6/1/2017 Module 3: Implementing virtual machines

4. Set your subscription by typing the following cmdlet, and then pressing Enter:

Select-AzureRmSubscription -SubscriptionName "<subscription


name>"

<subscription name> is the name of the subscription that you chose from the list that was
returned in step 3.

5. Use the following code block to create the virtual machine, storage account, and
associated network objects. In the code, you must replace <chosen storage account
name> and <chosen Azure location name> with the appropriate values from your
environment.

$stName = "<chosen storage account name>"


$locName = "<chosen Azure location name>"
$rgName = "TestRG"
New-AzureRmResourceGroup -Name $rgName -Location $locName
$storageAcc = New-AzureRmStorageAccount -ResourceGroupName
$rgName -Name $stName -Type "Standard_GRS" -Location $locName
$singleSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name
singleSubnet -AddressPrefix 10.0.0.0/24
$vnet = New-AzureRmVirtualNetwork -Name TestNet -
ResourceGroupName $rgName -Location $locName -AddressPrefix
10.0.0.0/16 -Subnet $singleSubnet
$pip = New-AzureRmPublicIpAddress -Name TestPIP -
ResourceGroupName $rgName -Location $locName -AllocationMethod
Dynamic
$nic = New-AzureRmNetworkInterface -Name TestNIC -
ResourceGroupName $rgName -Location $locName -SubnetId
$vnet.Subnets[0].Id -PublicIpAddressId $pip.Id
$cred = Get-Credential -Message "Type the name and password of
the local administrator account."
$vm = New-AzureRmVMConfig -VMName WindowsVM -VMSize "Standard_A1"

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 27/62
6/1/2017 Module 3: Implementing virtual machines

$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName


MyWindowsVM -Credential $cred -ProvisionVMAgent -EnableAutoUpdate
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName
MicrosoftWindowsServer -Offer WindowsServer -Skus 2012-R2-
Datacenter -Version "latest"
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
$osDiskUri = $storageAcc.PrimaryEndpoints.Blob.ToString() +
"vhds/WindowsVMosDisk.vhd"
$vm = Set-AzureRmVMOSDisk -VM $vm -Name "windowsvmosdisk" -VhdUri
$osDiskUri -CreateOption fromImage
New-AzureRmVM -ResourceGroupName $rgName -Location $locName -VM
$vm

Additional Reading: For more information on creating IaaS v2 virtual machines by
using Azure, refer to: http://aka.ms/J6lqcj

Creating virtual machines by using a deployment template

You can deploy virtual machines in Azure PowerShell by using an Azure Resource Manager
template, which you can use as a reusable definition for virtual­machine deployment. Azure
Resource Manager templates help to:
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 28/62
6/1/2017 Module 3: Implementing virtual machines

• Deploy Azure solutions and their workloads consistently.

• Manage all of your Azure resources in a solution put together by using resource groups.

• Apply RBAC to specify access to users, groups, and services.

• Use tagging to streamline resource­based identification and auditing tasks.

You create Azure Resource Manager templates as JavaScript Object Notation (JSON) files
that contain definitions of virtual machines and other Azure objects for deployment or
configuration. The following code is part of a JSON template for the deployment of an Azure
IaaS v2 virtual machine:

{
"$schema": "http://schema.management.azure.com/schemas/2014-04-
01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"newStorageAccountName": {
"type": "string",
"metadata": {
"Description": "Unique DNS name for the storage
account where the virtual machine's disks will be placed."
}
},
"adminUsername": {
"type": "string",
"metadata": {
"Description": "User name for the virtual machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"Description": "Password for the virtual machine."
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 29/62
6/1/2017 Module 3: Implementing virtual machines

}
},
"dnsNameForPublicIP": {
"type": "string",
"metadata": {
"Description": "Unique DNS Name for the Public IP
used to access the virtual machine."
}
},
"windowsOSVersion": {
"type": "string",
"defaultValue": "2012-R2-Datacenter",
"allowedValues": [
"2008-R2-SP1",
"2012-Datacenter",
"2012-R2-Datacenter",
"Windows-Server-Technical-Preview"
],
"metadata": {
"Description": "The Windows version for the virtual
machine. This will pick a fully updated image of this given
Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter,
2012-R2-Datacenter, Windows-Server-Technical-Preview."
}
}
},
"variables": {
"location": "West US",
"imagePublisher": "MicrosoftWindowsServer",
"imageOffer": "WindowsServer",
"OSDiskName": "osdiskforwindowssimple",
"nicName": "myVMNic",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 30/62
6/1/2017 Module 3: Implementing virtual machines

"subnetPrefix": "10.0.0.0/24",
"storageAccountType": "Standard_LRS",
"publicIPAddressName": "myPublicIP",
"publicIPAddressType": "Dynamic",
"vmStorageAccountContainerName": "vhds",
"vmName": "MyWindowsVM",
"vmSize": "Standard_D1",
"virtualNetworkName": "MyVNET",
"vnetID": "
[resourceId('Microsoft.Network/virtualNetworks',variables('virtua
lNetworkName'))]",
"subnetRef": "
[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]
"
},

Deploying a virtual machine by using a template

To utilize the definitions hosted within a JSON template such as the one above, you must use
the New­AzureRMResourceGroupDeployment cmdlet with the –Template switch. The
following example creates an Azure Resource Manager resource group named TestRG, and
then deploys the template contents into the resource group in the West US region:

$deployName="TestDeployment"

$RGName="TestRG"

$locname="West US"

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 31/62
6/1/2017 Module 3: Implementing virtual machines

$templateURI="https://raw.githubusercontent.com/Azure/azure-
quickstart-templates/master/101-simple-windows-
vm/azuredeploy.json"

New-AzureRmResourceGroup –Name $RGName –Location $locName

New-AzureRmResourceGroupDeployment -Name $deployName -


ResourceGroupName $RGName -TemplateUri $templateURI

Additional Reading: For more information on deploying IaaS v2 virtual machines by
using Azure PowerShell and Azure Resource Manager templates, refer to:
http://aka.ms/Bt1gf6

Demonstration: Creating a virtual machine by using the
Azure portal
In this demonstration, you will see how to create a virtual machine by using the Azure portal.

Demonstration Steps

1. In Internet Explorer, navigate to https://portal.azure.com. Sign in using the Microsoft
account that is either the Service Administrator or Co­administrator of your subscription.

2. From the Hub menu, create a new IaaS v2 virtual machine with the following properties:

o Name: AdatumTestVM1
o User name: Instructor
o Password: Pa$$w0rd
o Resource Group: TestRG1
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 32/62
6/1/2017 Module 3: Implementing virtual machines

o Size: A1 Standard

Lab A: Creating IaaS v2 virtual machines in Azure

Scenario
As part of the planning for deployment of IaaS v2 virtual machines to Azure, A. Datum has
evaluated its deployment options. You must use the Azure portal and Azure PowerShell to
deploy two Windows virtual machines for the Database tier of the Research and Development
application. Additionally, to facilitate resource tracking, you should ensure that the virtual
machines are part of the same resource group.

Objectives
After completing this lab, you will be able to:

• Create virtual machines by using the Azure portal and Azure PowerShell.

• Validate virtual­machine creation.

Lab Setup

Estimated Time: 35 minutes

Virtual machine: 20533C­MIA­CL1

User name: Student

Password: Pa$$w0rd

Exercise 1: Creating virtual machines by using the Azure portal and
Azure PowerShell

Scenario

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 33/62
6/1/2017 Module 3: Implementing virtual machines

You must deploy two virtual machines that are running Windows Server 2012 R2 Datacenter.
Name these machines ResDevDB1 and ResDevDB2, and use them as database servers for
the Research and Development app, ResDev. You will use the Azure portal to deploy one of
the virtual machines, and you will use Azure PowerShell to deploy the other VM. You must
deploy both virtual machines into the ResDevRG resource group, and you must configure the
virtual machines to use the database subnet of the HQ­VNET virtual network. After deploying
the virtual machines, you will confirm that the virtual machines are deployed to the correct
resource group and are on the database subnet.

The main tasks for this exercise are as follows:

1. Use the Azure portal to create a virtual machine

2. Use Azure PowerShell to create a virtual machine

Task 1: Use the Azure portal to create a virtual machine

1. On MIA­CL1, in Internet Explorer, navigate to the Azure portal.

2. Sign in using the Microsoft account that is either the Service Administrator or Co­
administrator of your subscription.

3. From the Azure portal, create an IaaS v2 virtual machine with the following parameters:

o Name: ResDevDB1
o User name: Student
o Password: Pa$$w0rd
o Subscription: Your subscription
o Resource group: ResDevRG
o Location: accept the default location, which should match the location of the resource group.
o Size: A1 Standard
o Network name: HQ­VNET
o Subnet name: Database

Task 2: Use Azure PowerShell to create a virtual machine

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 34/62
6/1/2017 Module 3: Implementing virtual machines

1. On MIA­CL1, open a Windows PowerShell Integrated Scripting Environment (ISE) window.

In the Windows PowerShell ISE, open the script D:\Labfiles\Lab03\Starter\CreateRmVM.ps1 and
review its content.

2. Run the script.

3. When prompted to sign in, type the name of the account that is either the Service Administrator or
Co­administrator of your Azure subscription.

4. If you have multiple subscriptions, select the one to use in the labs in this module.

5. When the script is complete, leave the Windows PowerShell ISE window open.

Result: After completing this exercise, you will have created virtual machines by using the
Azure portal and Azure PowerShell.

Exercise 2: Validating virtual­machine creation

Scenario

You now must validate the creation and configuration of the virtual machines that you created
to ensure that they function properly.

The main tasks for this exercise are as follows:

1. Use Azure PowerShell to validate virtual­machine deployment

2. Use the Azure portal to validate virtual­machine deployment

Task 1: Use Azure PowerShell to validate virtual­machine deployment

1. In the Windows PowerShell ISE window, at the command prompt, type the following command, and
then press Enter:

Get-AzureRmResource | where {$_.ResourceType –like “*VirtualMachines”}

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 35/62
6/1/2017 Module 3: Implementing virtual machines

2. Confirm that the ResDevDB1 and the ResDevDB2 virtual machines are listed. Note that both virtual
machines belong to the ResDevRG resource group.

Task 2: Use the Azure portal to validate virtual­machine deployment

1. On MIA­CL1, in the Internet Explorer window, in the Azure portal, view the virtual machine
resources.

2. Confirm that both ResDevDB1 and ResDevDB2 have been created, that they belong to the
ResDevRG resource group, and that they reside on the Database subnet of the HQ­VNET virtual
network.

Result: After completing this exercise, you will have validated the creation and
configuration of Azure Virtual Machines.

Review Information
Review Question(s)

Lesson 4: Authoring Azure Resource Manager
templates

You use Azure Resource Manager templates to deploy large and complex Azure environments.
As a result, the syntax and definition of resource templates can contain a complex environment
of variable, resource, and parameter definitions that control deployment. If you want to create
and manage Azure Resource Manager template files, you must understand the basic
composition of resource template files, and the JSON standard that governs the syntax of
these files. This lesson shows you how to understand, modify, and create your own JSON­
based Azure Resource Manager templates for use in deploying virtual machines in your
environment.

Lesson Objectives
After completing this lesson, you will be able to:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 36/62
6/1/2017 Module 3: Implementing virtual machines

• Explain the structure of Azure Resource Manager templates.

• Explain how to modify Azure Resource Manager templates.

• Author an Azure Resource Manager template.

Azure Resource Manager templates overview

Azure Resource Manager templates contain JSON expressions that define one or more Azure
resources. Resource templates use the .json file­name extension, and you can name them with
any convention that best suits your organization. When creating and working with resource
templates, you should consider:

• Which resources you are going to deploy.

• Where your resources will be located.

• Which version of the resource provider API you will use.

• Whether there are dependencies between resources.

• When you will define deployment values. You can define them before creation, in the
template, or during deployment.

• If you want to retain deployment information or values.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 37/62
6/1/2017 Module 3: Implementing virtual machines

The resources that you choose to deploy must be available in the region that you select for
deployment. Some Azure regions do not support all resource types, and availability will vary
from region to region.

Understanding the structure of a resource template

In its simplest form, a resource template is similar to the following code sample:

{
"$schema": "http://schema.management.azure.com/schemas/2015-
01-01/deploymentTemplate.json#",
"contentVersion": "",
"parameters": { },
"variables": { },
"resources": [ ],
"outputs": { }
}

The following table describes the sections in the code sample above.

Element name Required Description

$schema Yes This is the location of the JSON schema file, which describes


the template language.

contentVersion Yes This arbitrary value defines the template’s version. You can


use any value that is helpful in tracking template versioning.

parameters No These values are provided during the deployment process to
customize resource deployments.

variables No These hold large or complex values, or values that frequently
repeat in the template. Variables help to simplify JSON
expressions in the template.

resources Yes These are resource types that you create or modify as part of


the deployment.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 38/62
6/1/2017 Module 3: Implementing virtual machines

Element name Required Description

outputs No These values are returned during and after deployment.

The next topic discusses these sections in more detail.

The following code comprises a complete template that deploys a web app and uses code
from a .zip file to provision the app:

{
"$schema": "http://schema.management.azure.com/schemas/2015-
01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"hostingPlanSku": {
"type": "string",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard",
"Premium"
],
"defaultValue": "Free"
}
},
"resources": [
{

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 39/62
6/1/2017 Module 3: Implementing virtual machines

"apiVersion": "2014-06-01",
"type": "Microsoft.Web/serverfarms",
"name": "[parameters('hostingPlanName')]",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('hostingPlanName')]",
"sku": "[parameters('hostingPlanSku')]",
"workerSize": "0",
"numberOfWorkers": 1
}
},
{
"apiVersion": "2014-06-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('siteName')]",
"location": "[resourceGroup().location]",
"tags": {
"environment": "test",
"team": "ARM"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms',
parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('siteName')]",
"serverFarm": "[parameters('hostingPlanName')]"
},
"resources": [
{
"apiVersion": "2014-06-01",
"type": "Extensions",
"name": "MSDeploy",
"dependsOn": [

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 40/62
6/1/2017 Module 3: Implementing virtual machines

"[resourceId('Microsoft.Web/sites',
parameters('siteName'))]"
],
"properties": {
"packageUri":
"https://auxmktplceprod.blob.core.windows.net/packages/StarterSit
e-modified.zip",
"dbType": "None",
"connectionString": "",
"setParameters": {
"Application Path": "[parameters('siteName')]"
}
}
}
]
}
],
"outputs": {
"siteUri": {
"type": "string",
"value": "
[concat('http://',reference(resourceId('Microsoft.Web/sites',
parameters('siteName'))).hostNames[0])]"
}
}
}

Additional Reading: For more information on Azure Resource Manager template
structure, refer to: http://aka.ms/Yxslmx

Modifying Azure Resource Manager templates

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 41/62
6/1/2017 Module 3: Implementing virtual machines

Azure Resource Manager template syntax can be complex, especially in a large­scale
deployment. Each section of the template has its own structure and syntax, and there are a
large number of functions and operators that you can use to define your deployment
configuration.

Understanding template sections

Templates include parameters, variables, resources, and outputs. The following text provides
specific information about each template section and the type of code that the section
contains.

Parameters

Parameters define the values that an administrator can input during the deployment process.
With parameters, you can specify customizations to the deployment process and make a
template more flexible and adaptable to different environments and uses. For example, you
might declare a parameter that allows you to specify an Azure region. Without this parameter,
you must define the Azure region specifically in the template, making the template only usable
for one region. However, when you use this parameter, you can choose which region to use
for your deployment.

You can define each parameter by using the elements that the following table describes.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 42/62
6/1/2017 Module 3: Implementing virtual machines

Element name Required Description

parameterName Yes This is the parameter’s name, and it must be a valid JavaScript identifier.

type Yes This is the parameter type, and can be a string, integer, Boolean, object,


or array.

defaultValue No This value is assigned automatically to the parameter, if you do not assign
one.

allowedValues No This is an array or list of values that define exactly which values the
parameter can contain.

minValue No This is the minimum value for integer parameters.

maxValue No This is the maximum value for integer parameters.

minLength No This is the minimum length for string and array parameters.

maxLength No This is the maximum length for string and array parameters.

Description No This description of the parameter displays to users of the template. This
description is optional.

The following code provides examples of parameters, as defined in a sample template file:

"parameters": {
"siteName": {
"type": "string",
"minLength": 2,
"maxLength": 60
},
"siteLocation": {
"type": "string",
"minLength": 2
},
"hostingPlanName": {
"type": "string"
},
"hostingPlanSku": {

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 43/62
6/1/2017 Module 3: Implementing virtual machines

"type": "string",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard",
"Premium"
],
"defaultValue": "Free"

Variables

Variables contain values that you can reuse throughout your template. Variables typically are
based on values that you provide by using parameters, and typically are often combined or
computed. The following code provides examples of variables as defined in a sample template
file:

"variables": {
"environmentSettings": {
"test": {
"instancesSize": "Small",
"instancesCount": 1
},
"prod": {
"instancesSize": "Large",
"instancesCount": 4
}
},
"currentEnvironmentSettings": "
[variables('environmentSettings')
[parameters('environmentName')]]",
"instancesSize": "
[variables('currentEnvironmentSettings').instancesSize",

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 44/62
6/1/2017 Module 3: Implementing virtual machines

"instancesCount": "
[variables('currentEnvironmentSettings').instancesCount"
}

Resources

The resources section is where you define how the majority of the deployment process
occurs. Resource types can be inherently complex, and constructing the resources section of
your template requires knowledge of the types that you are deploying.

You define resources by using the elements in the following table.

Element name Required Description

apiVersion Yes This is the version of the representational state transfer (REST) API that


you use to create the resource.

type Yes This is the resource type, which is a combination of the resource provider


namespace and the resource type that the provider supports.

name Yes This is the resource name, and it must follow Uniform Resource Identifier


(URI) component restrictions.

location No This is the supported datacenter location for the provided resource.

tags No These are tags that are associated with the resource.

comments No These are your documentation notes for the resource.

dependsOn No These are other resources on which this resource depends, or parent
resources. The dependsOn element and the resources element determine
the order in which resources deploy. If you do not specify either element,
resources deploy in parallel.

properties No These are resource­specific settings. You specify these by using REST
API operation values.

resources No These child resources depend on this resource for their functionality. You
must define this element and the dependsOn element to define the
parent/child relationship completely.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 45/62
6/1/2017 Module 3: Implementing virtual machines

The following code contains examples of resource definitions in an Azure Resource Manager
template:

"resources": [
{
"apiVersion": "2014-06-01",
"type": "Microsoft.Web/serverfarms",
"name": "[parameters('hostingPlanName')]",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('hostingPlanName')]",
"sku": "[parameters('hostingPlanSku')]",
"workerSize": "0",
"numberOfWorkers": 1
}
},
{
"apiVersion": "2014-06-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('siteName')]",
"location": "[resourceGroup().location]",
"tags": {
"environment": "test",
"team": "ARM"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms',
parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('siteName')]",
"serverFarm": "[parameters('hostingPlanName')]"
},
"resources": [

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 46/62
6/1/2017 Module 3: Implementing virtual machines

{
"apiVersion": "2014-06-01",
"type": "Extensions",
"name": "MSDeploy",
"dependsOn": [
"[resourceId('Microsoft.Web/sites',
parameters('siteName'))]"
],
"properties": {
"packageUri":
"https://auxmktplceprod.blob.core.windows.net/packages/StarterSit
e-modified.zip",
"dbType": "None",
"connectionString": "",
"setParameters": {
"Application Path": "[parameters('siteName')]"
}
}
}
]
}
]

Outputs

The outputs section allows you to specify values that return as part of the deployment
process. For example, you could return the URI value of a resource that was deployed in the
template. The following table describes the elements included in the outputs section of the
Azure Resource Manager template.

Element name Required Description

outputName Yes Name of the output value. This must be a valid JavaScript identifier.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 47/62
6/1/2017 Module 3: Implementing virtual machines

Element name Required Description

Type Yes Type of the output value. The types supported are the same as those


supported by parameters.

value Yes Expression that provides the returned output value.

The following example shows a value that is returned in the Outputs section.

"outputs": {
"siteUri" : {
"type" : "string",
"value": "
[concat('http://',reference(resourceId('Microsoft.Web/sites',
parameters('siteName'))).hostNames[0])]"
}
}

Additional Reading: For more information about Azure Resource Manager template
sections, refer to:
http://aka.ms/Yxslmx

Understanding template functions

The following table details the functions that you can use in your template to customize the
deployment process further.

Function group Description

Numeric These functions work with integer variable types.

String These functions work with string variable types.

Array These functions work with arrays and array values.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 48/62
6/1/2017 Module 3: Implementing virtual machines

Function group Description

Deployment value These functions retrieve values from sections of the template or values related to
deployment.

Resource These functions retrieve values related to resources.

The following list contains some examples of template functions:

• add(): This function returns the sum of two integers. For example, add(2,5) returns an
integer value of 7.

• concat(): This function combines two or more string or array values into a single string or
array value. For example, concat(‘Hello,’World’) returns a string value of ‘HelloWorld’.

• toLower(): This function converts a string to entirely lower­case characters. For example
toLower(‘Adatum’) returns a string value of ‘adatum’.

• parameters(): This function returns the value of a parameter that has been defined in the
template. For example, parameters(‘locName’) returns the value specified by the template
user for the locName parameter.

Additional Reading: For more information about Azure Resource Manager template
functions, refer to: http://aka.ms/Jcr7f7

Demonstration: Authoring an Azure Resource Manager
template
In this demonstration, you will see how to:

• Open an Azure Resource Manager template in Visual Studio.

• View the different sections of an Azure Resource Manager template.

Demonstration Steps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 49/62
6/1/2017 Module 3: Implementing virtual machines

1. On MIA­CL1, open the Visual Studio solution located at
D:\Labfiles\Lab03\Starter\ResDev\ResDevLinuxDeploy \ResDevLinuxDeploy.sln.

2. View the contents of the azuredeploy.json template.

3. Initiate the deployment process, but do not complete it.

4. Close all open applications without saving any files.

5. On the taskbar, right­click Windows PowerShell, and then click Run as administrator.

6. In the User Account Control dialog box, click Yes.

7. At the command prompt, type the following command, and then press Enter:

Reset-Azure

8. When prompted, sign in by using the Microsoft account associated with your Azure
subscription.

9. If you have multiple Azure subscriptions, select the one you want to target with the
script.

10. When prompted for confirmation, type y.

Note: This script might remove Azure services in your subscription. Therefore, we
recommend that you use an Azure trial pass that was provisioned specifically for this
course, and not your own Azure account.
The script will take 5­10 minutes to reset your Microsoft Azure environment, and
ready it for demos and labs in the next module.
The script removes all storage, virtual machines (VMs), virtual networks and
gateways, cloud services, and resource groups.
Important: The script might not be able to get exclusive access to a storage account to
delete it (you will see an error, if this occurs). If you find objects remaining after the
reset script is complete, you can re­run Reset­Azure script, or use the full Azure
Management Portal to manually delete all the objects in your Azure subscription, with
the exception of the default directory.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 50/62
6/1/2017 Module 3: Implementing virtual machines

Lesson 5: Overview of IaaS v1 virtual machines

As a best practice, use IaaS v2 virtual machines for Azure implementations in a production
environment because of the full feature set of IaaS v2 infrastructure when compared to IaaS
v1. IaaS v2 is also the default implementation model that the Azure portal and the Azure CLI
use. Although we do not recommend IaaS v1 virtual machines for a common production
deployment, your environment might have existing IaaS v1 virtual machines that you need to
manage. This lesson covers the basics of IaaS v1 components, and details how you can create
and manage IaaS v1 virtual machines.

Lesson Objectives
After completing this lesson, you will be able to:

• Explain the concept of IaaS Cloud Services.

• Describe how to create IaaS v1 virtual machines.

Overview of IaaS Cloud Services

IaaS Cloud Services are similar to the PaaS Cloud Services, which you can use to host web
and worker roles. For more information about PaaS, refer to “Module 8: Implementing PaaS

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 51/62
6/1/2017 Module 3: Implementing virtual machines

Cloud Services”.

In both IaaS v1 and PaaS v1, the cloud service is the network container for hosting Azure
Virtual Machines. You cannot create an Azure virtual machine without first specifying a cloud
service to use.

Any virtual machine in a cloud service can communicate directly with all other virtual
machines in that cloud service by using Azure communications. All communications within a
cloud service are internal to that cloud service only, and virtual machines are not using the
Internet to communicate with each other.

A built­in Azure DNS server provides name resolution for all virtual machines within the same
cloud service. If you want to extend this name resolution, you will need to configure your own
DNS solution. An example of when you might do this is if you want to include on­premises
resources.

Cloud services have an assigned, DNS name that is accessible publically, and that takes the
form unique cloud service name.cloudapp.net. A cloud service has at least one VIP address
assigned, and the cloud service VIP allows inbound connections to Azure Virtual Machines
from the Internet.

The Cloud Services object is part of IaaS v1 and the Azure Service Management model. For
general deployment of Azure IaaS resources, we recommend IaaS v2 and the Azure Resource
Manager model, as previously discussed in this lesson.

Creating IaaS v1 virtual machines

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 52/62
6/1/2017 Module 3: Implementing virtual machines

If you use the Classic Portal, you can either use the QUICK CREATE option to provision a
virtual machine rapidly, and then configure and customize it later, or use the FROM
GALLERY option to select an image from the gallery, and configure it.

When you use the QUICK CREATE method, you only need to provide the following
information to provision a virtual machine:

• A DNS name for the virtual machine.

• An image from which to provision the virtual machine.

• A pricing­tier size for the virtual machine. A1 is the default for a Windows­based virtual
machine.

• A user name and password.

• A region or affinity group.

When you use the FROM GALLERY option, you need to provide more information to
provision a virtual machine, including:

• An image from the gallery.

• A version­release date for the image to ensure that they have the most up­to­date version.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 53/62
6/1/2017 Module 3: Implementing virtual machines

• A VM name.

• A pricing­tier size for the virtual machine. A1 Standard is the default for a Windows­based
virtual machine.

• A user name and password.

• A Cloud Service in which to create the virtual machine. Either create a new one or select an
existing one.

• A region, affinity group, or virtual network in which to deploy the virtual machine.

• A storage account.

• An availability set (optional).

• Additional endpoints (optional).

• An install VM Agent (optional).

• Configuration and security extensions (optional).

Deploying virtual machines by using Azure PowerShell

You also can use the Azure PowerShell interface to create IaaS v1 virtual machines by using
Windows PowerShell cmdlets.

You can define a virtual­machine configuration, and then create the virtual machine, as the
following sample code shows:

$newVM = New-AzureVMConfig -name $vmname -Instance $instance -


ImageName $osimage | Add-AzureProvisioningConfig -Windows -
AdminUsername $adminname -Password $password | Set-AzureSubnet -
SubnetNames $subnet
New-AzureVM -ServiceName $cloudservice -AffinityGroup
$affinitygroup -VMs $newVM -VNetName $vnet -DnsSettings $dns -
WaitForBoot

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 54/62
6/1/2017 Module 3: Implementing virtual machines

Alternatively, you can create and configure a virtual machine in one step, as the following code
sample shows:

New-AzureQuickVM -Windows -ImageName $osimage -Location $location


-Name $vmname –ServiceName $svcName -InstanceSize $size -
AdminUserName $adminname –Password $password

There are more configuration options if you use the New­AzureVMConfig and New­
AzureVM cmdlets, such as the ability to use a static internal IP address by using Set­
AzureStaticVNetIP. New­AzureVMConfig enables you to create more complex virtual­
machine configurations, and then pass those configurations to New­AzureVM.

Lab B: Deploying IaaS v2 virtual machines by using
Azure Resource Manager templates

Scenario

You must use an Azure Resource Manager template to deploy two additional Linux virtual
machines and two additional Windows virtual machines that the ResDev application will use.
The virtual machines should be part of the ResDevRG resource group, to facilitate resource
tracking. Linux virtual machines should reside on the app subnet of the HQ­VNET virtual
network, and Windows virtual machines should reside on the web subnet of the HQ­VNET
virtual network.

Objectives
After completing this lab, you must be able to:

• Use Visual Studio and an Azure Resource Manager template to deploy IaaS v2 virtual
machines.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 55/62
6/1/2017 Module 3: Implementing virtual machines

Use Azure PowerShell and an Azure Resource Manager template to deploy virtual
machines.

Lab Setup

Estimated Time: 25 minutes

Virtual machine: 20533C­MIA­CL1

User name: Student

Password: Pa$$w0rd

The virtual machine should be running from the previous lab.

Exercise 1: Using Visual Studio and an Azure Resource Manager
template to deploy IaaS v2 virtual machines

Scenario

You must use Visual Studio to deploy two Linux IaaS v2 virtual machines for use as app
servers in the ResDev app. You should name the servers ResDevApp1 and ResDevApp2. You
have a deployment­template solution and the deployment details for both virtual machines.
You must deploy the two virtual machines from Visual Studio, and then confirm that the
virtual machines have been deployed successfully by using Azure PowerShell.

The main tasks for this exercise are as follows:

1. Use Visual Studio to deploy the Linux app server’s virtual machines

2. Use Azure PowerShell to validate the deployment of the app server’s virtual machines

Task 1: Use Visual Studio to deploy the Linux app server’s virtual machines

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 56/62
6/1/2017 Module 3: Implementing virtual machines

1. On MIA­CL1, open the Visual Studio solution located at
D:\Labfiles\Lab03\Starter\ResDev\ResDevLinuxDeploy.

2. View the contents of the azuredeploy.json template.

3. In the Solution Explorer, right­click ResDevLinuxDeploy, and then start a new deployment
process for the first virtual machine.

4. Deploy a new virtual machine into the ResDevRG resource group, by using the following parameter
values:

o vmName: ResDevApp1
o adminUsername: Student
o adminPassword: Pa$$w0rd
o virtualNetworkName: HQ­VNET
o resourceGroupName: ResDevRG
o subnetName: App
o vmSize: Standard_D1
o ubuntuOSVersion: 14.04.2­LTS
o storageAccountType: Standard_LRS
o Save password: enabled

Note: Deployment will run with the output that appears in the Output pane, which is at the
bottom of the window. When deployment is complete, you will receive a message stating that
the template was deployed successfully to resource group ResDevRG.

5. View the contents of the Azuredeploy.parameters.json file to see that the parameters that you
entered have been saved in this file.

6. Start another deployment process by using the deployment that you used for the first virtual
machine.

7. Repeat step 4, changing only the following parameter:

o vmName: ResDevApp2

Note: Deployment will run with the output that appears in the Output pane, which is at the
bottom of the window. When deployment is complete, you will receive a message stating the
template was deployed successfully to resource group ResDevRG.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 57/62
6/1/2017 Module 3: Implementing virtual machines

8. Close the solution but leave Visual Studio open.

Task 2: Use Azure PowerShell to validate the deployment of the app server’s virtual machines

1. On MIA­CL1, launch Windows PowerShell ISE as Administrator.

2. With the Service Administrator or Co­administrator credentials, sign in to the subscription to which
you deployed virtual machines in the previous task of this exercise by using the following cmdlet:

Login-AzureRMAccount

3. If you have multiple subscriptions associated with your account, at the Windows PowerShell ISE
prompt, type the following cmdlet, and then press Enter

Get-AzureRmSubscription

4. Identify the name of the Azure subscription to which you deployed virtual machines in the previous
task of this exercise, type in the following cmdlet, and then press Enter (replace ‘Name of your
subscription’ with the actual name of your subscription and make sure to enclose the name of your
subscription in single quotes):

Set-AzureRmContext –SubscriptionName ‘Name of your subscription’

5. In the Windows PowerShell ISE, at the command prompt, type the following cmdlet, and then press
Enter:

Find-AzureRMResource –ResourceGroupNameContains ResDevRG | Format-Table –


Property ResourceName, ResourceType

6. In the cmdlet output, note the resources created in this exercise: ResDevApp1 and ResDevApp2
virtual machines, and an NIC, public IP, and storage account for each virtual machine.

7. Leave the Windows PowerShell ISE window open for the next exercise.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 58/62
6/1/2017 Module 3: Implementing virtual machines

Result: After completing this exercise, you will have deployed Azure Virtual Machines by
using Visual Studio and an Azure Resource Manager template.

Exercise 2: Using Azure PowerShell and an Azure Resource
Manager template to deploy virtual machines

Scenario

You must deploy the Web tier virtual machines by using an Azure Resource Manager template
and the Azure portal. The Web tier should consist of two virtual machines that are running
Windows Server 2012 R2, ResDevWeb1 and ResDevWeb2. You should deploy them to the
ResDevRG resource group, and then host them on the web subnet of the HQ­VNet virtual
network. You have a template and a Windows PowerShell script that you should edit to
complete the deployment. After you deploy the virtual machines, confirm the deployment by
viewing the newly deployed resources in the Azure portal.

The main tasks for this exercise are as follows:

1. Use Azure PowerShell to deploy the Windows virtual machines

2. Use the Azure portal to validate deployment of the Windows virtual machines

3. Reset the environment

Task 1: Use Azure PowerShell to deploy the Windows virtual machines

1. In the Windows PowerShell ISE window that you opened in the previous exercise, open
D:\Labfiles\Lab03\Starter\ResDev\ ResDevWindowsDeploy.ps1

2. Review the script that will initiate the template.

Note: Note the $templateFile and $rgName variables. These represent the location of the
Azure Resource Manager template file and the resource group to which you will deploy the
virtual machines.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 59/62
6/1/2017 Module 3: Implementing virtual machines

3. Switch to Visual Studio and open the file D:\Labfiles\Lab03\Starter\ResDev
\ResDevWindowsDeployTemplate.json.

Note: Note that the template has the same structure as the template for the Linux virtual
machines in the previous exercise. The only difference between the two templates is the
variables declaring the image and operating system details.

4. Close Visual Studio.

5. Switch back to the Windows PowerShell ISE window and run the ResDevWindowsDeploy.ps1
script. When prompted, provide the following values:

o vmName: ResDevWeb1
o adminUsername: Student
o adminPassword: Pa$$w0rd
o virtualNetworkName: HQ­VNET
o subnetName: Web

6. When the script completes, repeat step 5, changing only the value of the vmName parameter to
ResDevWeb2

Task 2: Use the Azure portal to validate deployment of the Windows virtual machines

1. In Internet Explorer, browse to the Azure portal.

2. Sign in using the Microsoft account that is either the Service Administrator or Co­administrator of
your subscription.

3. Navigate to the blade of the ResDevRG resource group.

4. On the ResDevRG resource group blade, view the full list of its resources.

Note: Note the virtual machines, and the NIC and public IP resources for each virtual
machine.

5. View the details for the ResDevWeb1 virtual machine. On the ResDevWeb1 blade, note that
ResDevWeb1 has been assigned to the HQ­VNet/Web virtual network/subnet, and the operating

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 60/62
6/1/2017 Module 3: Implementing virtual machines

system is Windows.

6. Close Internet Explorer.

Task 3: Reset the environment

1. Close all open applications without saving any files.

2. On the taskbar, right­click Windows PowerShell, and then click Run as administrator. In the User
Account Control dialog, click Yes.

3. Type the following command, and then press Enter:

Reset-Azure

4. When prompted, sign in by using the Microsoft account associated with your Azure subscription.

5. If you have multiple Azure subscriptions, select the one you want to target with the script.

6. When prompted for confirmation, type y.

Note: This script might remove Azure services in your subscription. Therefore, we recommend
that you use an Azure trial pass that was provisioned specifically for this course, and not your
own Azure account.
The script will take 5­10 minutes to reset your Microsoft Azure environment, and prepare it for
the next lab.
The script removes all storage, VMs, virtual networks and gateways, cloud services, and
resource groups.
Important: The script might not be able to get exclusive access to a storage account to delete it
(you will see an error, if this occurs). If you still find objects after the reset script is complete, you
can rerun the Reset­Azure script, or use the full Azure portal to manually delete all the objects
in your Azure subscription, with the exception of the default directory.

Result: After completing this exercise, you will have deployed Azure Virtual Machines by
using Windows PowerShell and a Resource Manager template.

Review Information
Review Question(s)
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 61/62
6/1/2017 Module 3: Implementing virtual machines

Module Review and Takeaways

Best Practice:
• Use IaaS v2 virtual machines for new virtual­machine and solution deployments.

• Use Azure Resource Manager resource groups to manage and deploy virtual
machines.

• Use a consistent naming convention for your IaaS infrastructure.

• Use Azure Resource Manager templates to deploy and modify virtual machines that
have the same management or operational lifecycle.

Review Question(s)

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=5 62/62

You might also like