AZ-204 Archives - Learn Smart Coding https://blogs.learnsmartcoding.com/tag/az-204/ Everyone can code! Sat, 27 Nov 2021 14:52:43 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 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
AZ-204 Developing Solutions for Microsoft Azure https://blogs.learnsmartcoding.com/2021/10/29/az-204-developing-solutions-for-microsoft-azure/ https://blogs.learnsmartcoding.com/2021/10/29/az-204-developing-solutions-for-microsoft-azure/#respond Fri, 29 Oct 2021 21:35:50 +0000 https://karthiktechblog.com/?p=834 Introduction In this post, I will provide guidance on preparing Exam AZ-204 Developing Solutions for Microsoft Azure. Preparing for certification is a crucial activity for any IT or development professional Learn new skills to boost your productivity. Earn certifications that show you are keeping pace with today’s technical roles and requirements. In this guide, you […]

The post AZ-204 Developing Solutions for Microsoft Azure appeared first on Learn Smart Coding.

]]>
Introduction

In this post, I will provide guidance on preparing Exam AZ-204 Developing Solutions for Microsoft Azure.

Preparing for certification is a crucial activity for any IT or development professional

Learn new skills to boost your productivity. Earn certifications that show you are keeping pace with today’s technical roles and requirements.

In this guide, you will learn everything you need to know to help you prepare for the Certified Azure Developer Associate certification.

The content of this exam was updated on March 26, 2021. Please download the skills measured document for more information.

Whom Exam AZ-204 certification is for ?

Microsoft is now going in the direction of career-focused certifications rather than certifications for specific technologies.

The Certified Azure Developer Associate (AZ-204) certification is for someone who wants to become or is a developer.

The core technologies used are Azure SDKs, serverless, containerization, security, and automation. Instead of focusing solely on a piece of technology, the certification is focused on the tools that will help you either fill in the Azure developer gaps or learn to become a developer in Azure.

AZ-204 Developing Solutions for Microsoft Azure

Getting Started

Azure getting started - AZ-204 Developing Solutions for Microsoft Azure

AZ-204 Developing Solutions for Microsoft Azure Skills Measured

  • Develop Azure compute solutions (25-30%)
  • Develop for Azure storage (15-20%)
  • Implement Azure security (20-25%)
  • Monitor, troubleshoot, and optimize Azure solutions (15-20%)
  • Connect to and consume Azure services and third-party services (15-20%)

I have covered each of the topics under the above sections in detail. You will get to read about the step by step tutorial and also real-time lab exercise on my Youtube channel

Develop Azure compute solutions (25-30%)


Implement IaaS solutions


Create Azure App Service Web Apps

  • create an Azure App Service Web App
  • enable diagnostics logging
  • deploy code to a web app
  • configure web app settings including SSL, API settings, and connection strings
  • implement autoscaling rules including scheduled autoscaling and autoscaling by operational or system metrics


Implement Azure functions

  • create and deploy Azure Functions apps
  • implement input and output bindings for a function
  • function triggers by using data operations, timers, and webhooks
  • implementing Azure Durable Functions
  • implementation of custom handlers

Develop for Azure storage (15-20%)

Develop solutions that use Cosmos DB storage

  • select the appropriate API and SDK for a solution
  • implement partitioning schemes and partition keys
  • perform operations on data and Cosmos DB containers
  • set the appropriate consistency level for operations
  • manage change feed notifications

Develop solutions that use blob storage

  • move items in Blob storage between storage accounts or containers
  • set and retrieve properties and metadata
  • perform operations on data by using the appropriate SDK
  • implementing storage policies, and data archiving and retention

Implement Azure security (20-25%)

Implementing user authentication and authorization

  • authenticate and authorize users by using the Microsoft Identity platform
  • authenticate and authorize users and apps by using Azure Active Directory
  • create and implement shared access signatures

Implement secure cloud solutions

  • secure app configuration data by using App Configuration Azure Key Vault
  • develop code that uses keys, secrets, and certificates stored in Azure Key Vault
  • implement Managed Identities for Azure resources
  • implement solutions that interact with Microsoft Graph

Monitor, troubleshoot, and optimize Azure solutions (15-20%)

Integrate caching and content delivery within solutions

  • configure cache and expiration policies for Azure Redis Cache
  • implement secure and optimized application cache patterns including data sizing, connections, encryption, and expiration

Instrument solutions to support monitoring and logging

  • configure an app or service to use Application Insights
  • analyze and troubleshoot solutions by using Azure Monitor
  • implement Application Insights web tests and alerts

Connect to and consume Azure services and third-party services (15-20%)

Implement API Management

  • create an APIM instance
  • configure authentication for APIs
  • define policies for APIs

Develop event-based solutions

  • implement solutions that use Azure Event Grid
  • implement solutions that use Azure Event Hubs

Develop message-based solutions

  • implement solutions that use Azure Service Bus
  • implement solutions that use Azure Queue Storage queues

For each of these topics, the study link will be provided, and video tutorials.

Conclusion

The Certified Azure Developer Associate (AZ-204) certification is for someone who wants to become or is a developer. Not everyone learns the same way. Some read book cover to cover, some watch videos, some practice more in the lab. Whatever the path is, this guide can help you finish this certification. You can do this if you work hard. All the best, happy coding!.

The post AZ-204 Developing Solutions for Microsoft Azure appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2021/10/29/az-204-developing-solutions-for-microsoft-azure/feed/ 0 834
Microsoft Azure Developer: Create Serverless Functions in Azure Portal https://blogs.learnsmartcoding.com/2020/07/05/microsoft-azure-developer-create-serverless-functions-in-azure-portal/ https://blogs.learnsmartcoding.com/2020/07/05/microsoft-azure-developer-create-serverless-functions-in-azure-portal/#respond Sun, 05 Jul 2020 15:24:23 +0000 https://karthiktechblog.com/?p=556 Create Serverless Functions in the Azure Portal. Azure functions have the capability to greatly speed up your development, reduce your cost, and allows you to automatically scale to meet the high demand. What is Azure Functions? Functions as a Service (FaaS) – A platform for running “functions”, which are nothing but your code running in […]

The post Microsoft Azure Developer: Create Serverless Functions in Azure Portal appeared first on Learn Smart Coding.

]]>
Create Serverless Functions in the Azure Portal. Azure functions have the capability to greatly speed up your development, reduce your cost, and allows you to automatically scale to meet the high demand.

What is Azure Functions?

Functions as a Service (FaaS) – A platform for running “functions”, which are nothing but your code running in response to an event.

Features of Serverless Functions

  • Automated and flexible scaling based on your workload volume.
  • Integrated programming model based on triggers and bindings.
  • End-to-end development experience, from building and debugging to deploying and monitoring with integrated tools and built-in DevOps capabilities.
  • Variety of programming languages and hosting options.
azure functions supported language

Triggers

Various triggers used to invoke Azure Functions.

  • A function runs at a specific time using a timer trigger.
  • Message Trigger: Listen to a message in a queue and process it as and when a message arrives.
  • HTTP Request: create a web API that responds to different HTTP methods.
  • Azure functions respond to the webhook callback. Third-party service triggers callbacks.
azure serverless functions trigger
Triggers

Bindings

Binding to a function is used to connect another resource to the function.

Different bindings, input bindings, output bindings, or both can be used. Data from bindings are provided to the function as parameters.

You can mix and match different bindings to suit your needs. Bindings are optional. A function might have one or multiple inputs and/or output bindings.

azure serverless functions bindings

Read more on Azure Functions triggers and bindings concepts this has details on supported bindings.

Serverless Architecture

What is Serverless Architecture? what are the benefits that brings to us ?

  • Azure will manage servers.
  • Per-second billing model. Pay only when your code runs. There is also a monthly free grant which is sufficient for any developers who are exploring serverless functions.
  • Automatic scaling. Application demands met automatically.

Azure functions is simpler, cheaper and more scalable.

azure serverless functions hosting models

Creating Functions in the Azure Portal

In this module, I will show how to create azure functions in a azure portal.

Visit https://Portal.azure.com and login with your azure portal account.

If you are new or do not have Azure subscription, visit Create your Azure free account today and get your free $200 credit.

Create Azure Function App

Search for “Function App” in the search box in the top and click on “Function App” to create.

Creating Functions in the Azure Portal
dashboard of function app

Above page is the dashboard of Function App. Click on “Create Function App” to create a new one.

Basic Configuration

creating function app basic configuration

Always create a new resource group for any new service that you create. This will help in managing it easily.

What is a resource group? A resource group is a container that holds related resources for an Azure solution.

Choose a unique name for the Function App. I have provided as “karthiktechblog-function-app” that will end up forming a base URL as http://karthiktechblog-function-app.azurewebsites.net/.

Choose the publish option as code or docker. In this example, we choose as code and in docker post, I will show how to use Docker as publish option.

Next is to choose the Runtime Stack and its version. last part in the basic configuration section is to choose the region. Choose the close one near by your location.

Hosting Configuration

creating function app hosting configuration

Monitoring Configuration

creating function app monitoring configuration

Select Application Insights which is useful to find details of request in case of error.

Tags used to apply in your Azure resources, resource groups, and subscriptions to logically organize them into a taxonomy. Each tag consists of a name and a value pair. To read more about Tags visit here Use tags to organize your Azure resources and management hierarchy

Review & Create Configuration

This is the final page to verify the configuration made so far.

Review and create function app

Alright, now we have successfully created Function App. Now its time to create a new function and consume it from portal.

Creating a Function in Azure Portal

azure function app dashboard

From the azure Function App dashboard, click on Function in the left navigation bar. This will show you the available functions under this Function App.

azure function dashboard

Click on Add to create a new Function.

Next is to choose a template. There are many inbuilt templates that are available to the right-side panel, choose the one that fits your requirement. In my example, I will choose the HTTP Trigger.

azure function template

Next is to name the function and select the authorization level for the function.

function trigger details
  • anonymous: No API key is required.
  • function: A function-specific API key is required. This is the default value if none is provided.
  • admin: The master key is required.
Microsoft Azure Developer: Create Serverless Functions in Azure Portal

Now the function is ready. Click on Code and Test, you will see the default code created by the template.

This simple API will read the request and try to find a parameter called “name” and send a hello message. If name parameter is not sent, you will get a Bad Request (HTTP 400 status code).

Output is seen in the output tab and logs can be seen in the console.

Related Post

This post is part of Implement Azure functions, skill measured in AZ-204 and Exam AZ-203: Developing Solutions for Microsoft Azure

Conclusion

In this post, I showed you how to create Serverless Functions in the Azure Portal. That’s all from this post. If you have any questions or just want to chat with me, feel free to leave a comment below.

The post Microsoft Azure Developer: Create Serverless Functions in Azure Portal appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2020/07/05/microsoft-azure-developer-create-serverless-functions-in-azure-portal/feed/ 0 556
Exam AZ-203: Developing Solutions for Microsoft Azure https://blogs.learnsmartcoding.com/2019/12/26/exam-az-203-developing-solutions-for-microsoft-azure/ https://blogs.learnsmartcoding.com/2019/12/26/exam-az-203-developing-solutions-for-microsoft-azure/#respond Thu, 26 Dec 2019 08:37:30 +0000 https://karthiktechblog.com/?p=247 Introduction In this post, we will see the skills measured for the Exam AZ-203: Developing Solutions for Microsoft Azure and various examples for exam preparation. Note: The content of this exam was updated on November 6, 2019. I have highlighted in bold where the content is updated as of November 6, 2019. This exam retired […]

The post Exam AZ-203: Developing Solutions for Microsoft Azure appeared first on Learn Smart Coding.

]]>
Introduction

In this post, we will see the skills measured for the Exam AZ-203: Developing Solutions for Microsoft Azure and various examples for exam preparation.

Note: The content of this exam was updated on November 6, 2019. I have highlighted in bold where the content is updated as of November 6, 2019.

This exam retired on August 31, 2020. A replacement exam, AZ-204, is available. For more information, visit the AZ-204 exam details page.

There are several sections in each skill measured. I will be posting examples for each skill that is measured under this exam. By going through those posts, you will be able to cover this exam preparation.

Examples for each skill will have links on it, click on the link to navigate to the post.

However, I will recommend you to learn and practice more on each topic to be an expert.

Skills Measured: Developing Solutions for Microsoft Azure (AZ-203)

Develop Azure Infrastructure as a Service compute solutions (10-15%)

This part is further divided into three more sub-skills and they are measured as below.

Implement solutions that use virtual machines (VM)

  • provision VMs
  • create ARM templates
  • configure Azure Disk Encryption for VMs

Implement batch jobs by using Azure Batch Services

  • manage batch jobs by using Batch Service API
  • run a batch job by using Azure CLI, Azure portal, and other tools
  • write code to run an Azure Batch Services batch job

Create containerized solutions

  • create an Azure Managed Kubernetes Service (AKS) cluster
  • create container images for solutions
  • publish an image to the Azure Container Registry
  • run containers by using Azure Container Instance or AKS

Develop Azure Platform as a Service compute solution (20-25%)

This part is further divided into four more sub-skills and they are measured as below.

Create Azure App Service Web Apps

Create Azure App Service mobile apps

  • add push notifications for mobile apps
  • enable offline sync for mobile app
  • implement a remote instrumentation strategy for mobile devices

Create Azure App Service API apps

Implement Azure functions

  • implement input and output bindings for a function
  • implement function triggers by using data operations, timers, and webhooks
  • implement Azure Durable Functions
  • create Azure Function apps by using Visual Studio
  • implement Python Azure functions

Develop for Azure storage (15-20%)

This part is further divided into four more sub-skills and they are measured as below.

Develop solutions that use storage tables

  • design and implement policies for tables
  • query table storage by using code
  • implement partitioning schemes

Develop solutions that use Cosmos DB storage

  • create, read, update, and delete data by using appropriate APIs
  • implement partitioning schemes
  • set the appropriate consistency level for operations

Develop solutions that use a relational database

Develop solutions that use blob storage

  • move items in Blob storage between storage accounts or containers
  • set and retrieve properties and metadata
  • implement blob leasing
  • implement data archiving and retention
  • implement Geo Zone Redundant storage

Implement Azure security (10-15%)

This part is further divided into three more sub-skills and they are measured as below.

Implement authentication

  • implement authentication by using certificates, forms-based authentication, or tokens
  • implement multi-factor or Windows authentication by using Azure AD
  • implement OAuth2 authentication
  • implement Managed identities/Service Principal authentication •
  • implement Microsoft identity platform

Implement access control

  • implement CBAC (Claims-Based Access Control) authorization
  • implement RBAC (Role-Based Access Control) authorization
  • create shared access signatures

Implement secure data solutions

  • encrypt and decrypt data at rest and in transit
  • create, read, update, and delete keys, secrets, and certificates by using the KeyVault API

Monitor, troubleshoot, and optimize Azure solutions (10-15%)

This part is further divided into three more sub-skills and they are measured as below.

Develop code to support scalability of apps and services

  • implement autoscaling rules and patterns (schedule, operational/system metrics, singleton applications)
  • implement code that handles transient faults
  • implement AKS scaling strategies

Integrate caching and content delivery within solutions

  • store and retrieve data in Azure Redis cache
  • develop code to implement CDN’s in solutions
  • invalidate cache content (CDN or Redis)

Instrument solutions to support monitoring and logging

  • configure instrumentation in an app or service by using Application Insights
  • analyze and troubleshoot solutions by using Azure Monitor
  • implement Application Insights Web Test and Alerts

Connect to and consume Azure services and third-party services (20- 25%)

This part is further divided into five more sub-skills and they are measured as below.

Develop an App Service Logic App

  • create a Logic App
  • create a custom connector for Logic Apps
  • create a custom template for Logic Apps

Integrate Azure Search within solutions

  • create an Azure Search index
  • import searchable data
  • query the Azure Search index
  • implement cognitive search

Implement API Management

  • establish API Gateways
  • create an APIM instance
  • configure authentication for APIs
  • define policies for APIs

Develop event-based solutions

  • implement solutions that use Azure Event Grid
  • implement solutions that use Azure Notification Hubs
  • implement solutions that use Azure Event Hub

Develop message-based solutions

  • implement solutions that use Azure Service Bus
  • implement solutions that use Azure Queue Storage queues

For more details and latest update, visit https://docs.microsoft.com/en-us/learn/certifications/exams/az-203

Conclusion

In this post, you got to know what skills are measured for the Azure AZ-203 Developing Solutions for Microsoft Azure certification and links to various examples for the exam preparation.

That’s all from this article. If you have any questions or just want to chat with me, feel free to leave a comment below.

The post Exam AZ-203: Developing Solutions for Microsoft Azure appeared first on Learn Smart Coding.

]]>
https://blogs.learnsmartcoding.com/2019/12/26/exam-az-203-developing-solutions-for-microsoft-azure/feed/ 0 247