Azure Citadel
  • Blogs

  • ARM
  • Azure Arc
    • Overview
    • Azure Arc-enabled Servers
      • Prereqs
      • Scenario
      • Hack Overview
      • Azure Landing Zone
      • Arc Pilot resource group
      • Azure Monitoring Agent
      • Additional policy assignments
      • Access your on prem VMs
      • Create onboarding scripts
      • Onboarding using scripts
      • Inventory
      • Monitoring
      • SSH
      • Windows Admin Center
      • Governance
      • Custom Script Extension
      • Key Vault Extension
      • Managed Identity
    • Azure Arc-enabled Kubernetes
      • Prereqs
      • Background
      • Deploy Cluster
      • Connect to Arc
      • Enable GitOps
      • Deploy Application
      • Enable Azure AD
      • Enforce Policy
      • Enable Monitoring
      • Enable Azure Defender
      • Enable Data Services
      • Enable Application Delivery
    • Useful Links
  • Azure CLI
    • Install
    • Get started
    • JMESPATH queries
    • Integrate with Bash
  • Azure Landing Zones
    • Prereqs
    • Day 1
      • Azure Baristas
      • Day 1 Challenge
    • Day 2
      • Example
      • Day 2 Challenge
    • Day 3
      • Day 3 Challenge
    • Useful Links
  • Azure Policy
    • Azure Policy Basics
      • Policy Basics in the Azure Portal
      • Creating Policy via the CLI
      • Deploy If Not Exists
      • Management Groups and Initiatives
    • Creating Custom Policies
      • Customer scenario
      • Policy Aliases
      • Determine the logic
      • Create the custom policy
      • Define, assign and test
  • Azure Stack HCI
    • Overview
    • Useful Links
    • Updates from Microsoft Ignite 2022
  • Marketplace
    • Introduction
      • Terminology
      • Offer Types
    • Partner Center
    • Offer Type
    • Publish a VM Offer HOL
      • Getting Started
      • Create VM Image
      • Test VM Image
      • VM Offer with SIG
      • VM Offer with SAS
      • Publish Offer
    • Other VM Resources
    • Publish a Solution Template HOL
      • Getting Started
      • Create ARM Template
      • Validate ARM Template
      • Create UI Definition
      • Package Assets
      • Publish Offer
    • Publish a Managed App HOL
      • Getting Started
      • Create ARM Template
      • Validate ARM Template
      • Create UI Definition
      • Package Assets
      • Publish Offer
    • Managed Apps with AKS HOL
    • Other Managed App Resources
    • SaaS Offer HOLs
    • SaaS Offer Video Series
      • Video 1 - SaaS Offer Overview
      • Video 2 - Purchasing a SaaS Offer
      • Video 3 - Purchasing a Private SaaS Plan
      • Video 4 - Publishing a SaaS Offer
      • Video 5 - Publishing a Private SaaS Plan
      • Video 6 - SaaS Offer Technical Overview
      • Video 7 - Azure AD Application Registrations
      • Video 8 - Using the SaaS Offer REST Fulfillment API
      • Video 9 - The SaaS Client Library for .NET
      • Video 10 - Building a Simple SaaS Landing Page in .NET
      • Video 11 - Building a Simple SaaS Publisher Portal in .NET
      • Video 12 - SaaS Webhook Overview
      • Video 13 - Implementing a Simple SaaS Webhook in .NET
      • Video 14 - Securing a Simple SaaS Webhook in .NET
      • Video 15 - SaaS Metered Billing Overview
      • Video 16 - The SaaS Metered Billing API with REST
  • Microsoft Fabric
    • Theory
    • Prereqs
    • Fabric Capacity
    • Set up a Remote State
    • Create a repo from a GitHub template
    • Configure an app reg for development
    • Initial Terraform workflow
    • Expanding your config
    • Configure a workload identity
    • GitHub Actions for Microsoft Fabric
    • GitLab pipeline for Microsoft Fabric
  • Packer & Ansible
    • Packer
    • Ansible
    • Dynamic Inventories
    • Playbooks & Roles
    • Custom Roles
    • Shared Image Gallery
  • Partner
    • Lighthouse and Partner Admin Link
      • Microsoft Cloud Partner Program
      • Combining Lighthouse and PAL
      • Minimal Lighthouse definition
      • Using service principals
      • Privileged Identity Management
    • Useful Links
  • REST API
    • REST API theory
    • Using az rest
  • Setup
  • Terraform
    • Fundamentals
      • Initialise
      • Format
      • Validate
      • Plan
      • Apply
      • Adding resources
      • Locals and outputs
      • Managing state
      • Importing resources
      • Destroy
    • Working Environments for Terraform
      • Cloud Shell
      • macOS
      • Windows with PowerShell
      • Windows with Ubuntu in WSL2
    • Using AzAPI
      • Using the REST API
      • azapi_resource
      • Removing azapi_resource
      • azapi_update_resource
      • Data sources and outputs
      • Removing azapi_update_resource
  • Virtual Machines
    • Azure Bastion with native tools & AAD
    • Managed Identities

  • About
  • Archive
  1. Home
  2. Archive
  3. Network
  4. Core Concepts
  5. Virtual Network

Table of Contents

  • Lab Overview
    • Lab Diagram
  • Create a virtual network
  • Create virtual machines
  • Create the first VM
  • Create a second virtual machine
  • Install web server on virtual machine vnet1-vm-web1
  • View the web server in action
  • Next

Virtual Network

Create a Virtual Network with two subnets, and add a VM to each.

Lab Overview

In this lab, we will learn how to get started with on Azure to deploy your IaaS resources. We will create a virtual network (vNet) in Azure. We will then add two subnets in the lab and add two virtual machines, one in each subnet.

It is expected you have access to Azure portal and have an account and subscription created on Azure.

Lab Diagram

diagram

Create a virtual network

  1. To access the Azure portal, go to http://portal.azure.com

  2. Click on Create a resource > Networking > Virtual Network

  3. In Create virtual network, enter or select this information:

    Setting Value
    Subscription Select your subscription
    Resource group Select Create new, enter rg-lab, then select OK
    Name Enter vnet1
    Region Select (US) West US 2
  4. Click Next: IP Addresses

    Setting Value
    IPv4 address space Enter 10.1.0.0/16
  5. Click +Add subnet

    Setting Value
    Subnet-name Enter vnet1-subnet1
    Subnet - Address range Enter 10.1.1.0/24
  6. Click Add

  7. Repeat steps 4 and 5 to add one more subnet as below:

    Setting Value
    Subnet-name Enter vnet1-subnet2
    Subnet - Address range Enter 10.1.2.0/24
  8. Leave the rest as default and select Review + Create. Review the values. Your output should look like this:

    validation

  9. Click Create

  10. Once the deployment is complete, go to the search bar at the top and type ‘Virtual Networks’ (G+/). Select Virtual Networks in the search results. You should see vnet1 show up in the list.

    resource

Create virtual machines

Create a virtual machine in the virtual network.

Create the first VM

  1. On the upper-left side of the screen, select Create a resource > Compute > Virtual Machine

  2. In Create a virtual machine - Basics, enter or select this information:

    PROJECT DETAILS

    Setting Value
    Subscription Select your subscription.
    Resource group Select rg-lab. You created this in the previous section.

    INSTANCE DETAILS

    Setting Value
    Virtual machine name Enter vnet1-vm-mgmt1
    Region Select West US 2
    Availability options Leave the default No infrastructure redundancy required
    Image Leave the default Ubuntu Server 18.04 LTS
    Size Leave the default Standard DS2 v3

    ADMINISTRATOR ACCOUNT

    Setting Value
    Username Enter a user name of your choosing
    Password Enter a password of your choosing. The password must be at least 12 characters long and meet the defined complexity requirements.
    Confirm Password Reenter password

    INBOUND PORT RULES

    Setting Value
    Public inbound ports None
  3. Select Next : Disks

  4. In Create a virtual machine - Disks, leave the defaults and select Next : Networking

  5. In Create a virtual machine - network-conceptsing, select this information:

    Setting Value
    Virtual network Leave the default vnet1
    Subnet Leave the default vnet1-subnet1 (10.1.1.0/24)
    Public IP Leave the default (new) vnet1-vm-mgmt1-ip
    Public inbound ports Select Allow selected ports
    Select inbound ports Select HTTP and SSH
  6. Select Review + create. You’re taken to the Review + create page where Azure validates your configuration.

  7. When you see the Validation passed message, select Create.

  8. Once the deployment is complete, click Go to resource. This will take you to the VM overview page. Verify the VM status shows as Running.

Create a second virtual machine

Repeat the above steps to spin up a second virtual machine with the following configuration:

Setting Value
Instance name vnet1-vm-web1
Subnet vnet1
Subnet vnet1-subnet2
Public Inbound ports SSH, HTTP

Keep the rest of the parameters default and create the virtual machine.

Install web server on virtual machine vnet1-vm-web1

Connect to the virtual machine.

  1. Search virtual machines in the Search bar in the portal

  2. Select the virtual machine vnet1-vm-web1

  3. Go to the Overview page

  4. Copy the public IP address of the VM

  5. From your laptop terminal, run command:

    ssh <username>@<Public_IP_of_the_VM>
    
  6. Install apache2 on the server

    sudo apt-get -y update
    sudo apt-get -y install apache2
    
  7. Verify the service is running on the server. You should see a status of active (running) in the output:

    sudo service apache2 status
    
  8. When done, type exit to leave the SSH session.

View the web server in action

Use a web browser of your choice to view the default welcome page. Type the public IP address of the VM as the web address. The public IP address can be found on the VM overview page or as part of the SSH connection string you used earlier.

Verify the web page loads successfully.

apache

Next

In the next lab we will create Network Security Groups to control traffic via layer 4 ACLs.

Previous Virtual Network Network Security Groups