az-204 Archives - Learn Smart Coding https://blogs.learnsmartcoding.com/category/azure/az-204/ Everyone can code! Sat, 27 Nov 2021 14:52:43 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 209870635 Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4 https://blogs.learnsmartcoding.com/2021/11/27/provision-virtual-machines-using-arm-templates-implement-iaas-solutions-part-4/ https://blogs.learnsmartcoding.com/2021/11/27/provision-virtual-machines-using-arm-templates-implement-iaas-solutions-part-4/#respond Sat, 27 Nov 2021 14:52:43 +0000 https://karthiktechblog.com/?p=923 This post covers how to provision virtual machines using ARM Templates that is part 4 of Implement Iaas Solutions. We have been learning how to provision virtual machines using various methods like Azure Portal, CLI, Powershell. Let’s learn about ARM Templates. An ARM template is a JSON‑formatted file that is a configuration document that defines […]

The post Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4 appeared first on Learn Smart Coding.

]]>
This post covers how to provision virtual machines using ARM Templates that is part 4 of Implement Iaas Solutions. We have been learning how to provision virtual machines using various methods like Azure Portal, CLI, Powershell. Let’s learn about ARM Templates.

An ARM template is a JSON‑formatted file that is a configuration document that defines what resources you want to be deployed in Azure with their configurations. You can create any resource with an ARM template.

Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4

Understanding ARM Templates

I will be focusing on Virtual Machine in this ARM Template topic. ARM templates are a building block for deployment automation. Using ARM templates, you can parameterize the configuration elements for resources defined in an ARM template.

You can use parameters for commonly changed configuration elements such as virtual machine names and many more. Other elements are image names, network security, storage account name, and many more.

After that, you can then use that same ARM template repeatedly to deploy the environment defined in the template. However, use different parameters to customize each environment at deployment time.

For example, you can have each set of parameters for Dev, QA, Stage, and one for Production that will provide consistency to your deployments. 

How ARM Template works?

 You create an ARM template and then an ARM template is submitted to Azure Resource Manager for deployment. The tools used are Azure CLI, Powershell, Azure Portal.

Once the ARM Template is deployed, it reads the details inside the ARM Template like creating resources, depleting resources modifying existing properties or creating new properties.

Creating ARM Templates

  1. You can build and export an ARM template from the Azure portal.
  2. Write your own manually.
  3. Also, you can start from the Quickstart library, which is a collection of community templates available in the Azure portal in the Custom deployment blade.

In order to focus on the higher-level process of how ARM templates work, we will mainly cover the building and exporting of an ARM template in the Azure portal.

How it works?

After you deploy an ARM template, Resource Manager receives that template, formatted as JSON, and then converts the template into REST API operations. This means you can use ARM Templates using many tools that include Azure Portal, CLI, Powershell.

ARM Template Structure

Let’s go through the structure of the ARM Template.

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

First, we have some header information. Schema is the location of the JSON schema file that describes the template’s language.

Content version is the version of the template, which is defined by you so that you can version control your templates.

apiProfile, which allows for versioning of the resource types that are defined in the template.

Parameters, which are used to provide values during deployment so that the same template can be reused for multiple deployments. This is where you’ll define deployment‑specific configuration parameters, and this is very useful when you want to be able to use that same template over and over again, but change out the parameters for specific deployments. Common parameters are resource groups, regions, resource names, and network configurations.

Variables define values that are reused in your templates and are often constructed from parameter values.

Functions allow you to create customized functions that simplify your templates and help enable reuse of templates. A common use for functions is generating a resource name based on the environment that it’s being deployed into.
To create your own functions, see User-defined functions.

The commonly used function is concat which combines multiple string values and returns the concatenated string, or combines multiple arrays and returns the concatenated array.

Example

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "prefix": {
      "type": "string",
      "defaultValue": "prefix"
    }
  },
  "resources": [],
  "outputs": {
    "concatOutput": {
      "type": "string",
      "value": "[concat(parameters('prefix'), '-', uniqueString(resourceGroup().id))]"
    }
  }
}

for more information read it from string functions

DEMO

It is time for the demo, to get started we will log in to Azure Portal and create an ARM Template. Follow the instructions in detail of how to Provision virtual machines using the Azure portal | Implement IaaS solutions | Part 1

Once you are on the final page as shown in the image below.

Provision virtual machines using ARM Templates

Instead of clicking on create which we normally do, we will click on “Download a template for automation” to view the template. This creates the template and parameters JSON files needed for an ARM template‑based deployment for the virtual machine that we just configured.

From this screen at the top, we can click Download to download the template and parameters files, we can click Add to add them to a library for further deployments inside of Azure, or we can deploy them right from here.

Examining an ARM Template

Examining an ARM Template

In this template, we can see that we have three sections defined, Parameters, Variables, and Resources. It is important to note that not all the sections are mandated to fill, many are optional. If we don’t provide them, the default values will be taken.

In this template, we have 19 different parameters defined, 3 variables, and 5 resources.

Parameter section | ARM Template

The template starts with parameters, you can see that these are the parameters used to provide values for unique deployments allowing us to change them at runtime. In this section of a template, it’s just the declaration of the parameters. The actual parameters of values for this particular deployment are going to be in the parameters file.

Some of the exposed parameters in this template are location, networkInterfaceName, enableAcceleratedNetworking, networkSecurityGroupName, virtualNetworkName, networkSecurityGroupRules, and so on.

A collection of parameters are exposed in this template. The values are going to come from the parameters.json file. clicking on the parameter tab will present you with the following parameter values.

arm template parameter values

All the sections that we filled in the Azure portal to create a virtual machine are included in the parameter values.

Decoupling these values from the template allows us to use that template file over and over again, setting unique values for each deployment in this parameters file.

Variables section | ARM Template

Variables are used to define values for reuse in a template. And there are three variables in this template, we will look into those.

The first variable is nsgId. A system function being used, resourceId. This will return the resource ID of a defined resource. The value that is returned from that function is stored in the variable nsgId.

nsgId is reused within the ARM template so frequently.

Provision virtual machines using ARM Templates

We then see the virtual network name as the second variable that was passed in via a parameter. And then for the final variable, we see subnetRef. It’s going to use another system function, concat, to concatenate together the values of the vnetId variable, the string subnets, and a template parameter named subnetName. That’s going to combine those strings all together to set the value for subnetRef.

Resources section | ARM Template

The last part is resources. There are 5 resources defined in this template. These are the actual resources being deployed in Azure by this ARM template.

In the resources section, we have an important section called the dependsOn section, which is a list of resources that this resource depends on before it gets deployed. And so this is a way for us to define some ordering and how resources in this template are created. This network interface won’t be created until these three other resources defined are deployed.

Similarly, all the other sections are defined in this way and the ARM template will deploy the dependent resources first before any other resources are deployed.

Deploying ARM Template

Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4

This downloads a zip file containing parameter.json and template.json files. If I wanted to deploy this template as is, I can click Deploy and that will take me to the custom deployment page to start a deployment. Clicking Deploy, you can see that it has prepopulated the parameters that we entered when we created the ARM template.

Deploy a custom template

Let me show you how to build this template from scratch. In the search box, search with “Deploy a custom template” and choosing this will present a screen to get started with our own template.

Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4

You need to provide an Admin password that was not in the downloaded template. You can edit the parameter file and update the admin password there or provide it in the Azure portal.

Now, it’s a regular step to click on create a virtual machine.

Deploying ARM Template using Powershell

#Let's login, may launch a browser to authenticate the session.
Connect-AzAccount -SubscriptionName 'Demo Account'


#Ensure you're pointed at your correct subscription
Set-AzContext -SubscriptionName 'Demo Account'


#If you resources already exist, you can use this to remove the resource group
Remove-AzResourceGroup -Name 'lscdemo-rg'


#Recreate the Resource Group
New-AzResourceGroup -Name 'lscdemo-rg' -Location 'EastUS'


#We can deploy ARM Templates using the Portal, Azure CLI or PowerShell
#Make sure to set the adminPassword parameter in parameters.json around line 80 "adminPassword" prior to deployment.
#Once finished, look for ProvisioningState Succeeded.
New-AzResourceGroupDeployment `
    -Name mydeployment -ResourceGroupName 'lscdemo-rg' `
    -TemplateFile './template/template.json' `
    -TemplateParameterFile './template/parameters.json' 

Using this template we can now deploy the virtual machine in Azure.

Clean up resource

Now the Demo is complete for creating a virtual machine. It is time to clean up the resources we used.

When no longer needed, you can delete the resource group, virtual machine, and all related resources.

Go to the resource group for the virtual machine, then select Delete resource group. Confirm the name of the resource group to finish deleting the resources.

Related resources

Conclusion

In this post, I have covered the topic of the Provision of virtual machines using ARM Templates. This is part of implementing IaaS solutions, part 4. Happy learning!.

The post Provision virtual machines using ARM Templates | Implement IaaS solutions | Part 4 appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/11/27/provision-virtual-machines-using-arm-templates-implement-iaas-solutions-part-4/feed/ 0 923
Provision virtual machines using PowerShell | Implement IaaS solutions | Part 3 https://blogs.learnsmartcoding.com/2021/11/03/provision-virtual-machines-using-powershell-implement-iaas-solutions-part-3/ https://blogs.learnsmartcoding.com/2021/11/03/provision-virtual-machines-using-powershell-implement-iaas-solutions-part-3/#comments Wed, 03 Nov 2021 21:40:35 +0000 https://karthiktechblog.com/?p=881 Introduction This post covers how to provision virtual machines using PowerShell. This is part of implementing the IaaS solutions topic (AZ-204 Certification). This is a continuation of the previous post Provision virtual machines using Azure CLI. PowerShell scripts can be executed in various ways. You can use PowerShell from Azure Portal (Cloud Shell), PowerShell software, […]

The post Provision virtual machines using PowerShell | Implement IaaS solutions | Part 3 appeared first on Learn Smart Coding.

]]>
Introduction

This post covers how to provision virtual machines using PowerShell. This is part of implementing the IaaS solutions topic (AZ-204 Certification). This is a continuation of the previous post Provision virtual machines using Azure CLI.

Provision virtual machines using PowerShell | Implement IaaS solutions | Part 3

PowerShell scripts can be executed in various ways. You can use PowerShell from Azure Portal (Cloud Shell), PowerShell software, or using Visual Studio Code. I showed you how to use the PowerShell window in my previous demo. To install PowerShell in Visual Studio Code follow the instructions below.

The advantage of using Visual Studio Code IDE is that the syntax is nicely highlighted for the PowerShell commands. This helps in finding the issue upfront.

How to use PowerShell in Visual Studio Code IDE

Install Visual Studio Code IDE that is an open-source and free software from Microsoft.

Install PowerShell plugin from the extension. Refer to the below image.

PowerShell using Visual Studio Code editor

Install PowerShell on Windows, Linux, and macOS

Choose the right installation from this link. As of this writing, PowerShell 7 is the latest. To install the Azure Az module, use this link Install the Azure Az PowerShell module.

How to run PowerShell using Azure Cloud Shell – Azure Portal

Provision virtual machines using PowerShell | Implement IaaS solutions | Part 3

Log in to the Azure portal and on the top right side, click on “Cloud Shell”, which opens a prompt to choose either Bash or PowerShell.

Choose Bash to run Azure CLI commands. In our current demo, we will choose PowerShell. After choosing the PowerShell/Bash, it will prompt to install a Storage which will cost a small amount. This is really a small amount.

Provision virtual machines using PowerShell

Creating a virtual machine in Azure with Azure PowerShell using the Az module. Logically the process is the same as creating a virtual machine with Azure CLI.

The first step to creating a virtual machine in PowerShell is to create a PSCredential object which will hold the username and password.

This is used for the credential for the local administrator account on the virtual machine that is deployed.

To create that PSCredential, you define a username and password. Password should match the password requirement from Azure. E.g. combination of Capital letter, lower case letter, number, special characters and it should be 8 and 123 characters long.

Now, you need to convert the string password defined here into a secure string, and you can do that with the cmdlet ConvertTo‑SecureString

Once you have the username and password variables defined, you can create a new PSCredential object with New‑Object, specifying the PSCredential object type, and then passing in the username and password variables as parameters into New‑Object.

Complete PowerShell Commands to provision virtual machines

#This command is required only when you use PowerShell other than Azure Portal as Portal is signed i already we dont need this to run.
Connect-AzAccount -SubscriptionName 'Demo Account'
#Ensure you're pointed at your correct subscription (if you have more than one subscription)
Set-AzContext -SubscriptionName 'Demo Account'


#Create a Resource Group
New-AzResourceGroup -Name "LSCDemo-rg" -Location "EastUS"


#Create a credential to use in the VM creation
$username = 'demoadmin'
$password = ConvertTo-SecureString 'Strongpassword$%^&*' -AsPlainText -Force
$WindowsCred = New-Object System.Management.Automation.PSCredential ($username, $password)


#Create a Windows Virtual Machine, can be used for both Windows and Linux.
#Note, you can create Windows or Linux VMs with PowerShell by specifying the correct Image parameter.
New-AzVM `
    -ResourceGroupName 'LSCDemo-rg' `
    -Name 'LSCDemo-win-az' `
    -Image 'Win2019Datacenter' `
    -Credential $WindowsCred `
    -OpenPorts 3389


#Get the Public IP Address (select-object  is used to pick require property alone from entire JSON response)
Get-AzPublicIpAddress `
    -ResourceGroupName 'LSCDemo-rg' `
    -Name 'LSCDemo-win-az' | Select-Object IpAddress

In this demo, the screenshot shows how Azure rejects if the password does not match the requirements.

Provision virtual machines using PowerShell
Provision virtual machines using PowerShell

Now the VM is created and we have a public IP to remote login using RDP. You can check this post on how to log in to VM and install Web Server for application deployment.

Video tutorial

Clean up resource

Now the Demo is complete for creating a virtual machine. It is time to clean up the resources we used.

When no longer needed, you can delete the resource group, virtual machine, and all related resources.

Go to the resource group for the virtual machine, then select Delete resource group. Confirm the name of the resource group to finish deleting the resources.

Related resources

Conclusion

In this post, I have covered the topic of the Provision of virtual machines using Azure PowerShell that is part of implementing IaaS solutions. This post also covers various other PowerShell tools to use. For more, refer to AZ-204 Certification. Happy learning!.

The post Provision virtual machines using PowerShell | Implement IaaS solutions | Part 3 appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/11/03/provision-virtual-machines-using-powershell-implement-iaas-solutions-part-3/feed/ 1 881
Provision virtual machines using Azure CLI | Implement IaaS solutions | Part 2 https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-azure-cli-implement-iaas-solutions-part-2/ https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-azure-cli-implement-iaas-solutions-part-2/#respond Tue, 02 Nov 2021 19:10:35 +0000 https://karthiktechblog.com/?p=860 Introduction This post covers how to Provision virtual machines using Azure CLI. This is part of implementing the IaaS solutions topic. This is a continuation of the previous post Provision virtual machines using the Azure portal. This module’s topics are part of implementing IaaS solutions and I will cover “Provision Virtual Machine”. Provision virtual machines […]

The post Provision virtual machines using Azure CLI | Implement IaaS solutions | Part 2 appeared first on Learn Smart Coding.

]]>
Introduction

This post covers how to Provision virtual machines using Azure CLI. This is part of implementing the IaaS solutions topic. This is a continuation of the previous post Provision virtual machines using the Azure portal.

This module’s topics are part of implementing IaaS solutions and I will cover “Provision Virtual Machine”.

provision windows and linux virtual machine

Provision virtual machines using Azure CLI

In order to work with Azure CLI, first, we should download the Azure CLI and install it. I have a windows machine so I choose to download CLI for windows.

Install Azure CLI on Windows

The Azure CLI is available to install in Windows, macOS, and Linux environments. It can also be run in a Docker container and Azure Cloud Shell. View complete details here

Now, I have installed Azure CLI. Let’s get started with its usage.

How to use CLI

After CLI installation, you can use the windows command prompt or PowerShell.

I have used PowerShell for the demo.

Open PowerShell for CLI

Click on start or windows key => type “powershell” => open Windows PowerShell

On the PowerShell window, enter the script as below and log in interactively. Login interactively meaning, a browser will open and you need to sign in to Azure Portal with your Azure portal credentials.

az login

az stands for azure and will be recognized once Azure CLI is installed in your machine.

Provision virtual machines using Azure CLI

Azure CLI commands to provision windows virtual machines

There are a lot many az vm commands. the below commands are used to create a VM with minimum required configurations. to check the full command list check az vm commands.

#Login interactively and set a subscription to be the current active subscription. My subscription name is "Demo Account", chnage to your subscription name

az login
az account set --subscription "Demo Account"


#Create a Windows VM.

#check existing group listed in table format 
az group list --output table 


#Create a resource group.
az group create --name "LSCDemo-rg" --location "eastus"


#Creating a Windows Virtual Machine (for image, choose any avilable name)
az vm create 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-win-cli" 
    --image "win2019datacenter" 
    --admin-username "demoadmin" 
    --admin-password "jsfdhsd$$Ddd$%^&*" 


#Open RDP for remote access, it may already be open
az vm open-port 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-win-cli" 
    --port "3389"


#Get the IP Addresses for Remote Access
az vm list-ip-addresses 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-win-cli" 
    --output table

Provision virtual machine using Azure CLI | Implement IaaS solutions | Part 2

Verify and Log into the Windows VM via RDP

This topic is already covered in my previous post, if you haven’t read the post, check here Provision virtual machines using the Azure portal | Implement IaaS solutions | Part 1

Azure CLI commands to provision linux virtual machines

Creating Linux virtual machines is almost the same as creating a Windows VM. There are only a few changes and the authentication mechanism needs to be changed. Let’s dive in and learn.

The authentication mechanism used for Linux is SSH. First, we need to generate a public/private RSA key pair, to do so you can use “ssh-keygen” available in your machine.

Steps

  1. Type “ssh-keygen” in run command. This opens up a terminal.
  2. “Enter file in which to save the key (C:\Users\karth/.ssh/id_rsa):” for this promt, leave it. Just press enter. This action will create a folder under current user name.
  3. Enter passphare. enter a password here and then enter again when asked.
  4. That’s it, the file is created.
ssh-keygen for rsa key
ssh-keygen to generate RSA key for Linux
#Creating a Linux Virtual Machine
az vm create 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-linux-cli" 
    --image "UbuntuLTS" 
    --admin-username "demoadmin" 
    --authentication-type "ssh" 
    --ssh-key-value ~/.ssh/id_rsa.pub 


#OpenSSH for remote access, it may already be open
az vm open-port 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-linux-cli" 
    --port "22"



#Get the IP address for Remote Access
az vm list-ip-addresses 
    --resource-group "LSCDemo-rg" 
    --name "LSCDemo-linux-cli" 
    --output table


#Log into the Linux VM over SSH (paste the ip from above command, see image)
ssh demoadmin@PASTE_PUBLIC_IP_HERE

Provision virtual machines using Azure CLI

Connect to Linux VM

Once you attempt to connect to the VM, it will prompt for the passphrase that was used to create ssh file. Provide the same passphrase to connect to VM.

Provision virtual machine using Azure CLI | Implement IaaS solutions | Part 2

Video tutorial

Clean up resource

Now the Demo is complete for creating a virtual machine. It is time to clean up the resources we used.

When no longer needed, you can delete the resource group, virtual machine, and all related resources.

Go to the resource group for the virtual machine, then select Delete resource group. Confirm the name of the resource group to finish deleting the resources.

Related resources

Conclusion

In this post, I have covered the topic of the Provision of virtual machines using Azure CLI that is part of implementing IaaS solutions. This post covers CLI commands for creating both Windows and Linux VM. Other parts of this exam are covered in other posts. Happy learning!.

The post Provision virtual machines using Azure CLI | Implement IaaS solutions | Part 2 appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-azure-cli-implement-iaas-solutions-part-2/feed/ 0 860
Provision virtual machines using the Azure portal | Implement IaaS solutions | Part 1 https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-the-azure-portal-implement-iaas-solutions-part-1/ https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-the-azure-portal-implement-iaas-solutions-part-1/#respond Tue, 02 Nov 2021 13:07:23 +0000 https://karthiktechblog.com/?p=840 Introduction As part of Azure AZ-204 certification, this post will cover Provision virtual machines using the Azure portal that are part of Implement IaaS solutions. This module’s topics are part of implementing IaaS solutions and I will cover “Provision Virtual Machine”. What is infrastructure as a service (IaaS)? This is the foundational category of cloud […]

The post Provision virtual machines using the Azure portal | Implement IaaS solutions | Part 1 appeared first on Learn Smart Coding.

]]>
Introduction

As part of Azure AZ-204 certification, this post will cover Provision virtual machines using the Azure portal that are part of Implement IaaS solutions.

This module’s topics are part of implementing IaaS solutions and I will cover “Provision Virtual Machine”.

Provision virtual machines VM | Implement IaaS solutions

What is infrastructure as a service (IaaS)?

This is the foundational category of cloud computing services. With IaaS, you rent IT infrastructure—servers and virtual machines (VMs), storage, networks, and operating systems. You can use cloud providers such as Microsoft Azure on a pay-as-you-go basis.

What is Virtual Machine VM ?

A virtual machine, commonly shortened to just VM, is no different than any other physical computer like a laptop, smartphone, or server.

It has a CPU, memory, disks to store your files, and can connect to the internet if needed. While the parts that make up your computer (called hardware) are physical and tangible.

VMs are often thought of as virtual computers or software-defined computers within physical servers, existing only as code.

Virtual Machines used for the following

Building and deploying apps to the cloud

Trying out a new operating system (OS), including beta releases.

Backing up your existing OS

Spinning up a new environment to make it simpler and quicker for developers to run dev-test scenarios.

Accessing virus-infected data or running an old application by installing an older OS.

Running software or apps on operating systems that they weren’t originally intended for.

From Microsoft

Methods of Provision virtual machines VM.

Four ways you could create VM, Azure Portal, Azure CLI, Azure PowerShell, and Azure ARM Templates.

Video tutorial

Provision virtual machines VM using portal

Create Windows virtual machines in Azure

Azure VMs are an on-demand scalable cloud-computing resource. You can start and stop virtual machines anytime, and manage them from the Azure portal or with the Azure CLI.

You can also use a Remote Desktop Protocol (RDP) client to connect directly to the Windows desktop user interface (UI) and use the VM as if you were signed in to a local Windows computer.

Steps

Sign in to the Azure portal. If you do not have an account, don’t worry it is free to start with. Check out below for details.

Getting started with Azure
  • On the Azure portal, under Azure services, select Create a resource. The Create a resource pane appears.
  • In search services search box, search for “virtual” as you will see “Virtual machine”, click on it.
  • In the Basics tab, under Project details, make sure the correct subscription is selected and then choose to Create new resource group.
  • Choose an existing resource group or create a new one. I have named my new resource group as “LSCDemo-VM”.
  • Fill up the instance details as per the screenshot below. Here we have named “LSCVMDemo” as VM name and selected the region for our VM deployment.
  • pick up an image from the drop down, I picked “windows server 2016 datacenter” with standard power for this demo.
  • Chose a size of the VM as per the need.
Provision virtual machines using the Azure portal | Implement IaaS solutions  | Part 1
  • Provide Administarator account details like username and password.
  • Under Inbound port rules, choose Allow selected ports and then select RDP (3389) and HTTP (80) from the drop-down.
  • Leave the remaining defaults and then select the Review + create button at the bottom of the page.
  • After validation runs, select the Create button at the bottom of the page.
  • After deployment is complete, select Go to resource. Here you can see all the details of the newly created VM.
Provision virtual machines using the Azure portal RDP configuration

Deployment of VM completed.

Connect to virtual machine

VM dashboard

On the resource dashboard page, all the details of the virtual machine appear. select the Connect button then select RDP

Click on download RDP and open it. Depending on your machine be it MAC or Windows, the appropriate RDP file will be downloaded,

connect VM using RDP

Log into VM using username and password.

server configuration

Installation of web server in VM

Open a PowerShell prompt on the VM and run the following command:

Install-WindowsFeature -name Web-Server -IncludeManagementTools

To open PowerShell in windows, click on the start or run command, type “Powershell”. This will open the PowerShell window.

Installation of web server in VM

The webserver is now installed. To open Internet Information Service (IIS), go to Tools => Internet Information Service (IIS).

Now, we can deploy the applications to IIS.

Installation of web server in VM  open IIS

Clean up resource

Now the Demo is complete for creating a virtual machine. It is time to clean up the resources we used.

When no longer needed, you can delete the resource group, virtual machine, and all related resources.

Go to the resource group for the virtual machine, then select Delete resource group. Confirm the name of the resource group to finish deleting the resources.

Related resources

Resources

1. MSDN: Quickstart: Create a Windows virtual machine in the Azure portal

2. AZ-204 Developing Solutions for Microsoft Azure

Conclusion

In this post, I have covered the topic of the Provision of virtual machines using the Azure portal that is part of implementing IaaS solutions. Other parts of this exam are covered in other posts. Happy learning!.

The post Provision virtual machines using the Azure portal | Implement IaaS solutions | Part 1 appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/11/02/provision-virtual-machines-using-the-azure-portal-implement-iaas-solutions-part-1/feed/ 0 840