Module3 Azure Administration
Module3 Azure Administration
The infrastructure for your application is typically made up of many components – maybe a virtual machine,
storage account, and virtual network, or a web app, database, database server, and third-party services. These
components are not separate entities; instead they are related and interdependent parts of a single entity. You
want to deploy, manage, and monitor them as a group.
Azure Resource Manager enables you to work with the resources in your solution as a group. You can deploy,
update, or delete all the resources for your solution in a single, coordinated operation. You use a template for
deployment and that template can work for different environments such as testing, staging, and production.
Resource Manager provides security, auditing, and tagging features to help you manage your resources after
deployment.
Choose the tools and APIs that work best for you - they have the same capability and provide consistent results.
The following image shows how all the tools interact with the same Azure Resource Manager API. The API
passes requests to the Resource Manager service, which authenticates and authorizes the requests. Resource
Manager then routes the requests to the appropriate resource providers.
Benefits
Resource Manager provides several benefits:
You can deploy, manage, and monitor all the resources for your solution as a group, rather than handling
these resources individually.
You can repeatedly deploy your solution throughout the development lifecycle and have confidence
your resources are deployed in a consistent state.
You can manage your infrastructure through declarative templates rather than scripts.
You can define the dependencies between resources so they're deployed in the correct order.
You can apply access control to all services in your resource group because Role-Based Access Control
(RBAC) is natively integrated into the management platform.
You can apply tags to resources to logically organize all the resources in your subscription.
You can clarify your organization's billing by viewing costs for a group of resources sharing the same
tag.
Guidance
The following suggestions help you take full advantage of Resource Manager when working with your
solutions.
Define and deploy your infrastructure through the declarative syntax in Resource Manager templates,
rather than through imperative commands.
Define all deployment and configuration steps in the template. You should have no manual steps for
setting up your solution.
Run imperative commands to manage your resources, such as to start or stop an app or machine.
Arrange resources with the same lifecycle in a resource group. Use tags for all other organizing of
resources.
Terminology
If you're new to Azure Resource Manager (ARM), there are some terms you might not be familiar with.
resource - A manageable item that is available through Azure. Some common resources are a virtual
machine, storage account, web app, database, and virtual network, but there are many more.
resource group - A container that holds related resources for an Azure solution. The resource group can
include all the resources for the solution, or only those resources that you want to manage as a group. You
decide how you want to allocate resources to resource groups based on what makes the most sense for your
organization.
resource provider - A service that supplies the resources you can deploy and manage through Resource
Manager. Each resource provider offers operations for working with the resources that are deployed. Some
common resource providers are Microsoft.Compute, which supplies the virtual machine resource,
Microsoft.Storage, which supplies the storage account resource, and Microsoft.Web, which supplies
resources related to web apps.
ARM template - A JavaScript Object Notation (JSON) file that defines one or more resources to deploy
to a resource group. It also defines the dependencies between the deployed resources. The template can be
used to deploy the resources consistently and repeatedly.
declarative syntax - Syntax that lets you state “Here is what I intend to create” without having to write
the sequence of programming commands to create it. The Resource Manager template is an example of
declarative syntax. In the file, you define the properties for the infrastructure to deploy to Azure.
Resource providers
Each resource provider offers a set of resources and operations for working with an Azure service. For example,
if you want to store keys and secrets, you work with the Microsoft.KeyVault resource provider. This resource
provider offers a resource type called vaults for creating the key vault.
The name of a resource type is in the format: {resource-provider}/{resource-type}. For example, the key vault
type is Microsoft.KeyVault/vaults.
✔️Before getting started with deploying your resources, you should gain an understanding of the available
resource providers. Knowing the names of resource providers and resources helps you define resources you
want to deploy to Azure. Also, you need to know the valid locations and API versions for each resource type.
Considerations
Resource Groups are at their simplest a logical collection of resources. There are a couple of small rules for
resource groups.
All the resources in your group should share the same lifecycle. You deploy, update, and delete them
together. If one resource, such as a database server, needs to exist on a different deployment cycle it should
be in another resource group.
Each resource can only exist in one resource group.
You can add or remove a resource to a resource group at any time.
You can move a resource from one resource group to another group.
A resource group can contain resources that reside in different regions.
A resource group can be used to scope access control for administrative actions.
A resource can interact with resources in other resource groups. This interaction is common when the
two resources are related but don't share the same lifecycle (for example, web apps connecting to a
database).
When creating a resource group, you need to provide a location for that resource group. You may be wondering,
“Why does a resource group need a location? And, if the resources can have different locations than the
resource group, why does the resource group location matter at all?” The resource group stores metadata about
the resources. Therefore, when you specify a location for the resource group, you're specifying where that
metadata is stored. For compliance reasons, you may need to ensure that your data is stored in a particular
region.
✔️By scoping permissions to a resource group, you can add/remove and modify resources easily without
having to recreate assignments and scopes.
You can associate the lock with a subscription, resource group, or resource.
Locks are inherited by child resources.
Lock types
There are two types of resource locks.
✔️Only the Owner and User Access Administrator roles can create or delete management locks.
Moving Resources
Sometimes you may need to move resources to either a new subscription or a new resource group in the same
subscription.
When moving resources, both the source group and the target group are locked during the operation. Write and
delete operations are blocked on the resource groups until the move completes. This lock means you can't add,
update, or delete resources in the resource groups, but it doesn't mean the resources are frozen. For example, if
you move a virtual machine to a new resource group, an application accessing the virtual machine experiences
no downtime.
Limitations
Before beginning this process be sure to read the Move operation support for resources page. This page details
what resources can be moved between resources groups and subscriptions.
Implementation
To move resources, select the resource group containing those resources, and then select the Move button.
Select the resources to move and the destination resource group. Acknowledge that you need to update scripts.
✔️Just because a service can be moved doesn’t mean there aren’t restrictions. For example, you can move a
virtual network, but you must also move its dependent resources, like gateways.
Removing Resources
You can also delete individual resources within a resource group. For example, here we are deleting a virtual
network. Notice you can change the resource group on this page.
Resource Limits
Azure provides the ability to observe the number of each network resource type that you've deployed in your
subscription and what your subscription limits are. The ability to view resource usage against limits is helpful to
track current usage, and plan for future use.
Note: Only the Owner and User Access Administrator roles can manage the locks on the resources.
✔️Configure resource locks, move resources across resource groups, and remove resource groups are part of
the certification exam.
Azure Portal
The Azure Portal let's you build, manage, and monitor everything from simple web apps to complex cloud
applications in a single, unified console.
Search resources, services, and docs.
Manage resources.
Create customized dashboards and favorites.
Access the Cloud Shell.
Receive notifications.
Links to the Azure documentation.
1. Examine the icons next to the Dashboard drop-down. For example, New Dashboard, Upload, Download,
Edit, and Clone.
2. Click New Dashboard.
3. Practice adding, pinning, moving, resizing, and deleting tiles.
4. Click Done customizing to save your edits.
5. Select the Settings icon on the top banner. Experiment with different color themes. Apply your changes.
6. Practice reordering your Favorites list. Do this by holding and dragging list items up or down.
7. Notice how clicking a Favorite takes you to that page.
8. Click the Cost Management and Billing blade. Pin your Subscription information to your Dashboard.
9. Visit the Dashboard and make any arrangement changes you like.
10. Use the search textbox at the top of the page.
11. Type resource and notice context matches are provided.
12. Select Resource groups and then click + Add.
13. Review and create your first resource group.
Cloud Shell enables access to a browser-based command-line experience built with Azure management tasks in
mind. Leverage Cloud Shell to work untethered from a local machine in a way only the cloud can provide.
Azure Cloud Shell features
Is temporary and requires a new or existing Azure Files share to be mounted.
Offers an integrated graphical text editor based on the open-source Monaco Editor.
Authenticates automatically for instant access to your resources.
Runs on a temporary host provided on a per-session, per-user basis.
Times out after 20 minutes without interactive activity.
Requires a resource group, storage account, and Azure File share.
Uses the same Azure file share for both Bash and PowerShell.
Is assigned one machine per user account.
Persists $HOME using a 5-GB image held in your file share.
Permissions are set as a regular Linux user in Bash.
1. To use the Cloud Editor, type code .. You can also select the curly braces icon.
2. Select a file from the left navigation pane. For example, .profile.
3. Notice on the editor top banner, selections for Settings (Text Size and Font) and Upload/Download files.
4. Notice on the ellipses (...) on the far right for Save, Close Editor, and Open File.
5. Experiment as you have time, then close the Cloud Editor.
6. Close the Cloud Shell.
Azure PowerShell
Azure PowerShell is a module that you add to Windows PowerShell or PowerShell Core to enable you to
connect to your Azure subscription and manage resources. Azure PowerShell requires PowerShell to function.
PowerShell provides services such as the shell window and command parsing. Azure PowerShell adds the
Azure-specific commands.
For example, Azure PowerShell provides the New-AzVm command that creates a virtual machine inside your
Azure subscription. To use it, you would launch the PowerShell application and then issue a command such as
the following command:
New-AzVm `
-ResourceGroupName "CrmTestingResourceGroup" `
-Name "CrmUnitTests" `
-Image "UbuntuLTS"
...
Azure PowerShell is also available two ways: inside a browser via the Azure Cloud Shell, or with a local
installation on Linux, macOS, or the Windows operating system. In both cases, you have two modes from with
to choose: you can use it in interactive mode in which you manually issue one command at a time, or in
scripting mode where you execute a script that consists of multiple commands.
Az is the formal name for the Azure PowerShell module containing cmdlets to work with Azure features. It
contains hundreds of cmdlets that let you control nearly every aspect of every Azure resource. You can work
with the following features, and more:
Resource groups
Storage
VMs
Azure AD
Containers
Machine learning
Note: You might have seen or used Azure PowerShell commands that used an -AzureRM format. In December
2018 Microsoft released for general availability the AzureRM module replacement with the Az module. This
new module has several features, notably a shortened cmdlet noun prefix of -Az, which replaces AzureRM.
The Az module ships with backwards compatibility for the AzureRM module, so the -AzureRM cmdlet format
will work. However, going forward you should transition to the Az module and use the -Az commands.
The base PowerShell product ships with cmdlets that work with features such as sessions and background jobs.
You add modules to your PowerShell installation to get cmdlets that manipulate other features. For example,
there are third-party modules to work with ftp, administer your operating system, and access the file system.
There is also a convention for verb choice. You can use Get-Verb to retrieve examples, such as:
get retrieves data.
set inserts or updates data.
format formats data.
out directs output to a destination.
Cmdlet authors are encouraged to include a help file for each cmdlet. The Get-Help cmdlet displays the help
file for any cmdlet. For example, you could get help on the Get-ChildItem cmdlet with the following
statement:
Cmdlets are shipped in _modules. A PowerShell module is a DLL file that includes the code to process each
available cmdlet. You load cmdlets into PowerShell by loading the module containing them. You can get a list
of loaded modules using the Get-Module command:
Get-Module
Note: If at any time you receive errors about running scripts is disabled be sure to set the execution policy. Set-
ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
1. Depending on the NuGet version you have installed you might get a prompt to download and install the
latest version.
2. If prompted, install and import the NuGet provider.
1. By default, the PowerShell Gallery isn't configured as a trusted repository for PowerShellGet. The first
time you use the PowerShell Gallery, you will be prompted.
You are installing the modules from an untrusted repository. If you trust
this repository, change its InstallationPolicy value by running the Set-
PSRepository cmdlet. Are you sure you want to install the modules from
PSGallery'?
2. As prompted, install the modules.
1. Connect to Azure.
Connect-AzAccount
2. When prompted provide your credentials.
3. Verify your subscription information.
Get-AzSubscription
Create resources
1. Create a new resource group. Provide a different location if you like. The name must be unique within
your subscription. The location determines where the metadata for your resource group will be stored. You
use strings like “West US”, "North Europe", or “West India” to specify the location; alternatively, you can
use single word equivalents, such as westus, northeurope, or westindia. The core syntax is:
New-AzResourceGroup -name <name> -location <location>
2. Verify your resource group.
Get-AzResourceGroup
3. Remove your resource group. When prompted, confirm.
Remove-AzResourceGroup -Name Test
Azure CLI
Azure CLI is a command-line program to connect to Azure and execute administrative commands on Azure
resources. It runs on Linux, macOS, and Windows, and allows administrators and developers to execute their
commands through a terminal or a command-line prompt, (or script!) instead of a web browser. For example, to
restart a VM, you would use a command such as the following:
Azure CLI provides cross-platform command-line tools for managing Azure resources. You can install this
locally on computers running the Linux, macOS, or Windows operating systems. You can also use Azure CLI
from a browser through Azure Cloud Shell.
Interactive. First, for Windows operating systems, launch a shell such as cmd.exe, or for Linux or
macOS, use Bash. Then issue the command at the shell prompt.
Scripted. Assemble the Azure CLI commands into a shell script using the script syntax of your chosen
shell. Then execute the script.
Azure CLI lets you control nearly every aspect of every Azure resource. You can work with resource groups,
storage, VMs, Azure Active Directory (Azure AD), containers, machine learning, and so on.
Commands in the CLI are structured in groups and subgroups. Each group represents a service provided by
Azure, and the subgroups divide commands for these services into logical groupings. For example,
the storage group contains subgroups including account, blob, storage, and queue.
So, how do you find the particular commands you need? One way is to use az find. For example, if you
want to find commands that might help you manage a storage blob, you can use the following find command:
az find -q blob
If you already know the name of the command you want, the --help argument for that command will get you
more detailed information on the command, and for a command group, a list of the available subcommands. For
example, here's how you can get a list of the subgroups and commands for managing blob storage:
1. You run Azure CLI by opening a Bash shell for Linux or macOS, or from the command prompt or
PowerShell for Windows.
2. Start Azure CLI and verify your installation by running the version check:
az --version
Note: Running Azure CLI from PowerShell has some advantages over running Azure CLI from the Windows
command prompt. PowerShell provides more tab completion features than the command prompt.
Login to Azure
1. Because you're working with a local Azure CLI installation, you'll need to authenticate before you can
execute Azure commands. You do this by using the Azure CLI login command:
az login
2. Azure CLI will typically launch your default browser to open the Azure sign-in page. If this doesn't
work, follow the command-line instructions and enter an authorization code at https://aka.ms/devicelogin.
3. After a successful sign in, you'll be connected to your Azure subscription.
1. You'll often need to create a new resource group before you create a new Azure service, so we'll use
resource groups as an example to show how to create Azure resources from the CLI.
2. Azure CLI group create command creates a resource group. You must specify a name and location.
The name must be unique within your subscription. The location determines where the metadata for your
resource group will be stored. You use strings like “West US”, "North Europe", or “West India” to specify
the location; alternatively, you can use single word equivalents, such as westus, northeurope, or westindia.
The core syntax is:
az group create --name <name> --location <location>
1. For many Azure resources, Azure CLI provides a list subcommand to view resource details. For
example, the Azure CLI group list command lists your Azure resource groups. This is useful to verify
whether resource group creation was successful:
az group list
2. To get a more concise view, you can format the output as a simple table:
az group list --output table
3. If you have several items in the group list, you can filter the return values by adding a query option. Try
this command:
az group list --query "[?name == '<rg name>']"
Template Advantages
An Azure Resource Manager template precisely defines all the Resource Manager resources in a deployment.
You can deploy a Resource Manager template into a resource group as a single operation.
Using Resource Manager templates will make your deployments faster and more repeatable. For example, you
no longer have to create a VM in the portal, wait for it to finish, and then create the next VM. Resource
Manager takes care of the entire deployment for you.
Template Benefits
Templates improve consistency. Resource Manager templates provide a common language for you and
others to describe your deployments. Regardless of the tool or SDK that you use to deploy the template, the
structure, format, and expressions inside the template remain the same.
Templates help express complex deployments. Templates enable you to deploy multiple resources in
the correct order. For example, you wouldn't want to deploy a virtual machine prior to creating an operating
system (OS) disk or network interface. Resource Manager maps out each resource and its dependent
resources, and creates dependent resources first. Dependency mapping helps ensure that the deployment is
carried out in the correct order.
Templates reduce manual, error-prone tasks. Manually creating and connecting resources can be
time consuming, and it's easy to make mistakes. Resource Manager ensures that the deployment happens
the same way every time.
Templates are code. Templates express your requirements through code. Think of a template as a type
of Infrastructure as Code that can be shared, tested, and versioned similar to any other piece of software.
Also, because templates are code, you can create a “paper trail” that you can follow. The template code
documents the deployment. Most users maintain their templates under some kind of revision control, such
as GIT. When you change the template, its revision history also documents how the template (and your
deployment) has evolved over time.
Templates promote reuse. Your template can contain parameters that are filled in when the template
runs. A parameter can define a username or password, a domain name, and so on. Template parameters
enable you to create multiple versions of your infrastructure, such as staging and production, while still
utilizing the exact same template.
Templates are linkable. You can link Resource Manager templates together to make the templates
themselves modular. You can write small templates that each define a piece of a solution, and then combine
them to create a complete system.
Templates simplify orchestration. You only need to deploy the template to deploy all of your
resources. Normally this would take multiple operations.
Template Schema
ARM templates are written in JSON, which allows you to express data stored as an object (such as a virtual
machine) in text. A JSON document is essentially a collection of key-value pairs. Each key is a string, whose
value can be:
A string
A number
A Boolean expression
A list of values
An object (which is a collection of other key-value pairs)
A Resource Manager template can contain sections that are expressed using JSON notation, but are not related
to the JSON language itself:
{
"$schema": "http://schema.management.azure.com/schemas/2019-04-
01/deploymentTemplate.json#",
"contentVersion": "",
"parameters": {},
"variables": {},
"functions": [],
"resources": [],
"outputs": {}
}
Element
Required Description
name
Location of the JSON schema file that describes the version of the
$schema Yes
template language. Use the URL shown in the preceding example.
resources Yes Resource types that are deployed or updated in a resource group.
For more information, Understand the structure and syntax of Azure Resource Manager Templates.
Template Parameters
In the parameters section of the template, you specify which values you can input when deploying the
resources. The available properties for a parameter are:
"parameters": {
"<parameter-name>" : {
"type" : "<type-of-parameter-value>",
"defaultValue": "<default-value-of-parameter>",
"allowedValues": [ "<array-of-allowed-values>" ],
"minValue": <minimum-value-for-int>,
"maxValue": <maximum-value-for-int>,
"minLength": <minimum-length-for-string-or-array>,
"maxLength": <maximum-length-for-string-or-array-parameters>,
"metadata": {
"description": "<description-of-the parameter>"
}
}
}
Here's an example that illustrates two parameters: one for a virtual machine's (VM's) username, and one for its
password:
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
}
✔️You're limited to 256 parameters in a template. You can reduce the number of parameters by using objects
that contain multiple properties.
Template Variables
This template section is where you define values that are used throughout the template. Variables can help make
your templates easier to maintain. For example, you might define a storage account name one time as a variable,
and then use that variable throughout the template. If the storage account name changes, you need to only
update the variable once.
Here's an example that illustrates a few variables that describe networking features for a VM:
"variables": {
"nicName": "myVMNic",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",
"subnetPrefix": "10.0.0.0/24",
"publicIPAddressName": "myPublicIP",
"virtualNetworkName": "MyVNET"
}
Template Functions
This section is where you define procedures that you don't want to repeat throughout the template. Similar to
variables, functions can help make your templates easier to maintain.
"functions": [
{
"namespace": "contoso",
"members": {
"uniqueName": {
"parameters": [
{
"name": "namePrefix",
"type": "string"
}
],
"output": {
"type": "string",
"value": "[concat(toLower(parameters('namePrefix')),
uniqueString(resourceGroup().id))]"
}
}
}
}
],
Template Resources
This section is where you define the Azure resources that make up your deployment.
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-08-01",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsLabelPrefix')]"
}
}
}
Because resource types can change over time, apiVersion refers to the version of the resource type you want
to use. As resource types evolve, you can modify your templates to work with the latest features.
Template Outputs
This section is where you define any information you'd like to receive when the template runs. For example,
you might want to receive your VM's IP address or fully qualified domain name (FQDN), information you do
not know until the deployment runs.
"outputs": {
"<output-name>": {
"condition": "<boolean-value-whether-to-output-value>",
"type": "<type-of-output-value>",
"value": "<output-value-expression>",
"copy": {
"count": <number-of-iterations>,
"input": <values-for-the-variable>
}
}
}
Here's an example that illustrates an output named hostname. The FQDN value is read from the VM's public IP
address settings:
"outputs": {
"hostname": {
"type": "string",
"value":
"[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
}
}
✔️It is a good practice to comment your templates. For inline comments, you can comment a single line with //.
You can comment a block of lines with /* ... */. This can vary across different tools so be sure to check what
works for you.
QuickStart Templates
Azure Quickstart templates are Resource Manager templates provided by the Azure community.
Templates provide everything you need to deploy your solution, while others might serve as a starting point for
your template. Either way, you can study these templates to learn how to best author and structure your own
templates.
1. Start by browsing to the Azure Quickstart Templates gallery. In the gallery you will find a number of
popular and recently updated templates. These templates work with both Azure resources and popular
software packages.
2. Browse through the many different types of templates that are available.
3. Are there are any templates that are of interest to you?
Explore a template
Note: The Deploy to Azure button enables you to deploy the template directly through the Azure portal if you
wish.
Note: Scroll-down to the Use the template PowerShell code. You will need the TemplateURI in the next
demo. Copy the value. For example,
https://raw.githubusercontent.com/Azure/azure-quickstart-
templates/master/101-vm-simple-windows/azuredeploy.json
2. Click Browse on GitHub to navigate to the template's source code on GitHub.
3. Notice from this page you can also Deploy to Azure. Take a minute to view the Readme file. This helps
to determine if the template is for you.
4. Click Visualize to navigate to the Azure Resource Manager Visualizer.
5. Notice the resources that make up the deployment, including a VM, a storage account, and network
resources.
6. Use your mouse to arrange the resources. You can also use your mouse's scroll wheel to zoom in an out.
7. Click on the VM resource labeled SimpleWinVM.
8. Review the source code that defines the VM resource.
The resource's type is Microsoft.Compute/virtualMachines.
Its location, or Azure region, comes from the template parameter named location.
The VM's size is Standard_A2.
The computer name is read from a template variable, and the username and password for the VM
are read from template parameters.
9. Return to the QuickStart page that shows the files in the template. Copy the link to the azuredeploy.json
file.
1. If you are working with a local install of the PowerShell, you'll need to authenticate before you can
execute Azure commands. To do this, open the PowerShell ISE, or a PowerShell console as administrator,
and run the following command:
Connect-AzAccount
2. After successfully signing in, your account and subscription details should display in the PowerShell
console window. You must now select either a subscription or context, in which you will deploy your
resources. If only one subscription is present it will set the context to that subscription by default. Otherwise
you can specify the subscription to deploy resources into by running the following commands in sequence:
Get-AzContext
Set-AzContext -subscription < your subscription ID >
1. You'll often need to create a new resource group before you create a new Azure service or resource.
We'll use resource groups as an example to show how to create Azure resources from Azure PowerShell.
2. The Azure PowerShell New-AzResourceGroup command creates a resource group. You must specify a
name and location. The name must be unique within your subscription, and the location determines where
the metadata for your resource group will be stored. You use strings such as West US, North Europe, or
West India to specify the location. Alternatively, you can use single word equivalents, such as westus,
northeurope, or westindia.
3. Create the resource group into which we will deploy our resources using the following commands.
New-AzResourceGroup -Name < resource group name > -Location < your nearest
datacenter >
Note: In the previous example, we called a publicly available template on GitHub. You could also call a local
template or a secure storage location, and you could define the template filename and location as a variable for
use in the script. You can also specify the mode of deployment, including incremental or complete.
1. Once you have successfully deployed the template, you need to verify the deployment. To do this, run
the following commands:
Get-AzVM
2. Note the VM name, then run the following command to obtain additional VM details:
Get-AzVM -Name < your VM name i.e. SimpleWinVM > -resourcegroupname < your
resource group name >
3. You can also list the VMs in your subscription with the Get-AzVM -Status command. This can also
specify a VM with the -Name property. In the following example, we assign it to a PowerShell variable:
$vm = Get-AzVM -Name < your VM name i.e. SimpleWinVM > -ResourceGroupName
< your resource group name >
4. The interesting thing is that this is an object you can interact with. For example, you can take that object,
make changes, and then push changes back to Azure with the Update-AzVM command:
$ResourceGroupName = "ExerciseResources"
$vm = Get-AzVM -Name MyVM -ResourceGroupName $ResourceGroupName
$vm.HardwareProfile.vmSize = "Standard_A3"
Note: Depending on your datacenter location, you could receive an error related to the VM size not being
available in your region. You can modify the vmSize value to one that is available in your region.
✔️PowerShell's interactive mode is appropriate for one-off tasks. In our example, we'll likely use the same
resource group for the lifetime of the project, which means that creating it interactively is reasonable.
Interactive mode is often quicker and easier for this task than writing a script and then executing it only once.
✔️Consult with your instructor for how to access the lab instructions and lab environment (if provided).
Objectives
In this lab, you will:
✔️Consult with your instructor for how to access the lab instructions and lab environment (if provided).
Objectives
In this lab, you will:
✔️Consult with your instructor for how to access the lab instructions and lab environment (if provided).
Objectives
In this lab, you will:
✔️Consult with your instructor for how to access the lab instructions and lab environment (if provided).
Location
Name
Region
Subscription
Tag
Explanation
Location and Name are required by PowerShell (New-AzResourceGroup) and the CLI (az group create).
Check Answers
Review Question 2
Which of the following is not true about the Cloud Shell?
Provides an editor.
Requires an Azure file share.
Explanation
Each user account can be assigned multiple machines, is not true. The cloud shell is assigned one machine per
user account.
Check Answers
Review Question 3
You are managing Azure locally using PowerShell. You have launched the app as an Administrator. Which of
the following commands would you do first?
Connect-AzAccount
Get-AzResourceGroup
Get-AzSubscription
New-AzResourceGroup
Explanation
Connect-AzAccount. When you are working locally you are not automatically logged in to Azure. So, the first
thing you should do is to connect to Azure and provide your credentials.
Check Answers
Review Question 4
You have a new Azure subscription and need to move resoures to that subscription. Which of the following
resources cannot be moved? Select one.
Key vault
Storage account
Tenant
Virtual machine
Explanation
Check Answers
Review Question 5
Which of the following is not an element in the template schema? Select one.
Functions
Inputs
Outputs
Parameters
Explanation
Check Answers
Review Question 6
Which of the following best describes the format of an Azure Resource Manager template? Select one.
Explanation
A JSON document with key-value pairs. An Azure Resource Template is a JSON document with key-value
pairs.
Check Answers
Review Question 7
You are reviewing your virtual machine usage. You notice that you have reached the limit for virtual machines
in the US East region. Which of the following provides the easiest solution? Select one.
Explanation
Request support increase your limit. If you need to increase a default limit, there is a Request Increase link. You
will complete and submit the support request.
Check Answers
Additional Study
Microsoft Learn provides self paced skills training on a variety of topics. These Learn modules cover the
content you have just learned. You can search for additional modules by product, role, or level.