Skip to main content

Create Azure VM


Create VM using Custom Image
On-Premise
  • Prepare the VM. Make sure the VM has all the roles and features installed.
  • Run sysprep to prepare the machine.
  • Prepare the VM VHD.
Azure On-Premise
  • Create the Storage Container.
  • Upload the VHD.
  • Create a VM using the uploaded VHD.
(in Hyper V- Ned to sysprep the VM. )
In Powershell, Convert the .vhdx format to vhd (Since Azure supports only vhd)
Powershell Command:
Convert-vhd -Path ‘XXXXX’ -DestinationPath TemplateVM.vhd
Now need to upload this vhd onto Azure Storage Account
Login onto Azure using powershell
Login-AzureRmAccount
Add-AzureRmVhd -Destination StorageAccountname/Container/file.vhd
-LocalFilePath ‘XXXX’
-ResourceGroupName name

Outpiut:
MDS hash Calculation is completed. Uploaded.

Getting Started with VM Creation
Now that you understand how to plan for VMs, next we will learn various ways of Provisioning VMs.
Tool for deploying VMs:
  • Azure Portal
    • Classic portal: V1 VMs only
    • New portal: Both V1 and V2 VMs
  • Azure PowerShell
  • Azure CLI
  • ARM Template
Versions of VM (V1 and V2) are different from Generations of VM such as G1 and G2.
Azure supports G1 VMs only
OS Image Sources
Azure Marketplace
  • Contains recent versions for Windows and Linux distributions
VM Depot
  • Community managed Repository of Linux and FreeBSD VM images
Custom Images
  • Enterprise OS images with Applications that must be captured from VM in the Organization and uploaded in Azure to create further VMs
ARM Templates
Resource Manager templates are JSON files that define the resources to be deployed for an Azure solution.
JSON editor or Visual Studio Code can be used to create templates.
Prerequisites to create a template:
Features and Benefits of ARM Templates
ARM Templates allow you to deploy identical environments to test staging and production, ensuring high reliability.
  • Templates can be stored in the Azure Subscription and reused.
  • An entire Resource group can be exported as a Template.
  • ARM Templates can create resources in parallel.
  • ARM Templates can define dependencies among resources.
  • ARM Templates can create custom policies to control actions or operations that can be performed on resources.
Importantly, ARM templates help to reduce human error when deploying complex environments.
ARM template is another way to create one or more Azure VMs quickly.
Steps:
  • Create the Template: You can create your own template or you can get it from Azure Quickstarts Templates.
  • Create the Parameter File: To specify values for the resource parameters that were defined in the template or parameters files.
  • Create the Resource Group: All resources, like virtual machines, must be part of a resource group.
  • Deploy the Template: Once the template and resource files are ready, use the New-AzureRmResourceGroupDeployment command to implement the resource.
The template file can be created with a simple text editor and the file type is JSON.
Another popular way of managing VMs is using PowerShell or CLI interface. For this, you would need Azure Cloud Shell.
Azure Cloud Shell is an interactive, browser-accessible shell for managing Azure resources.
Features of Azure Cloud Shell:
  • It is a free shell that can be run directly on the Azure portal.
  • It has common Azure tools preinstalled and configured to use with your account.
Click the Cloud Shell button on the menu in the upper-right of the Azure portal, and you will able to launch both PowerShell and CLI interface.
It gives you the flexibility of choosing the shell experience that best suits the way you work.
Knowing Cloud Shell
  • It runs on a temporary machine provided on a per-session, per-user basis.
  • It times out after 20 minutes without interactive activity.
  • It can only be accessed with a file share attached.
  • It uses the same file share for both Bash and PowerShell.
  • It is assigned to a one machine per user account basis.
  • Permissions are set as a regular Linux user (Bash).
Authentication and Pricing – Cloud Shell
Automatic authentication
  • Cloud Shell securely and automatically authenticates on each session for instant access to your resources through the Azure CLI 2.0.
Pricing
  • The machine hosting Cloud Shell is free, with a prerequisite of a mounted Azure file share.
  • Regular storage costs apply.
Use Cloud shell to create and manage the VMs.

 Steps to Create VM using PS
1.    Create Azure Connection
2.    Create resource group
3.    Create networking resources such as subnet, Vnet, NIC, Public IP Address.
4.    Define a credential object
5.    Create a VM configuration
6.    Create virtual machine
PowerShell commands for above steps are uploaded in the Azure storage can be accessed from:
Azure Portal - Storage - frescostepguide - file - Azure VM - VM_Creation_PS.pdf
Using listed PS commands in the following cards you will be able to create a VM with configuration as below,
  • ResourceGroup - myResourceGroup
  • Location - EastUS
  • Subnet - mySubnet
  • AddressPrefix192.168.1.0/24
  • vnet - MYvNET
  • AddressPrefix - 192.168.0.0/16
  • VMSize - Standard_DS2
  • ComputerName - myVM
  • OS - Windows Server 2016 datacenter

Linux in Azure 

https://technorhythms9.blogspot.com/2020/05/linux-on-azure.html


Comments

Popular posts from this blog

Troubleshooting transient connection errors to Azure SQL Database

Troubleshooting transient connection errors to Azure SQL Database Dear friends, I'm Yogesh. At my work place, I have faced these type of issues at times.  Let us understand what is this transient error?  A transient error has an underlying cause that soon resolves itself. It causes occasionally is when the Azure system quickly shifts hardware resources to better load-balance various workloads. Most of these reconfiguration events finish in less than 60 seconds.  During this reconfiguration time span, you might have connectivity issues to SQL Database.  To handle them, implement retry logic in their code instead of surfacing them to users as application errors. If your client program uses ADO.NET, your program is told about the transient error by the throw of  SqlException . What is the solution? Can Retry logic works? When your program communicates with SQL Database through third-party middleware, ask the vendor whether the middle ware contains retry logic for tr

Geo-Replication in SQL Azure Database

Geo-Replication in SQL Azure Database Geo-Replication  is one of the Azure SQL features which allows making 3 readable replicas to your database in same or different data centers. Geo-Replication option is available for all databases and service tiers in all region. If it is enabled, the application initiates to a secondary database. we will review how to set up Geo-Replication on Azure SQL databases. Geo-Replication is an Azure SQL database feature that allows you to create a readable secondary database in the same region or cross-region. We can failover to the secondary database in case of an outage for a long time on the primary database server. We can also use this feature to migrate a database from one server to another server in the same or cross region with minimal downtime. Geo-replication uses the Always-on feature to replicate committed transactions to the secondary database asynchronously. Select the database, Click on 'Geo Replication' in left hand

DTU and eDTU in Azure SQL

DTU and eDTU in Azure SQL The performance of SQL Database is based on DTU. According to Microsoft, a DTU is a unit of measure of the resources that are guaranteed to be available to a single Azure SQL Database at a specific performance level within a single database tier. A DTU combines CPU, memory, data I/O, and transaction I/O. Databases can be placed into an  elastic pool  on a SQL Database server that shares a pool of resources among those databases. The shared pool of resources are measured by  elastic Database transition units (eDTU) . The advantages of an elastic pool are: They are scaled automatically. They provide predictable costs. They are widely used for  varying  and  unpredictable usage patterns . Determining DTUs for Workloads ·          If you are planning to move your on-premises Databases to Azure SQL Database, Azure provides a  DTU Calculator  to find the approximate DTUs required for setting up the database. ·