DEV Community

Cover image for How to Deploy and Configure Azure Monitor
daniel shaibu
daniel shaibu

Posted on

How to Deploy and Configure Azure Monitor

Intro: Azure Monitor is Microsoft’s unified monitoring solution for collecting metrics, logs, and insights across your Azure resources. To configure it properly, you typically follow these stages:

1. Prepare Your Azure Environment
From the Azure Portal:

  • Search Resource Groups

  • Select Create

  • Name it rg-alpha

  • Region: East US

  • Click Review + Create → Create

note: This group will hold all the resources Azure Monitor will observe.

**2. Create a Security Group (Optional but used in the **lab)
This group is used for log access permissions.

  • Search *Azure Active Directory / Entra ID *
  • Go to Groups → New Group

  • Group type: Security

  • Name:** App Log Examiners**

  • Create the group

3. Deploy Virtual Machines to Monitor
Azure Monitor needs resources to collect data from. The lab deploys two VMs:
A. Deploy Windows VM (WS‑VM1)

  • Search Virtual Machines → Create
  • Name: WS-VM1
  • Region: East US
  • Image: Windows Server 2022 Datacenter
  • Size: Standard_D4s_v3
  • Admin user:** prime**
  • Password: (your secure password)
  • Allow inbound port: RDP 3389
  • Create the VM

Configure Networking

  • Wait for the deployment to complete. Once deployment completes choose Go to resource.
  • On the WS-VM1 properties page, choose Networking.

  • On the Networking page, select the RDP rule.

  • On the RDP rule space, change the Source to My IP address and choose Save. This restricts incoming RDP connections to the IP address you’re currently using.

  • On the Networking page, choose Add inbound port rule.

  • On the Add inbound security rule page, configure the following settings and choose Add:
    Source:** Any**
    Source: **** *
    Destination: Any
    Service: HTTP
    Action: Allow
    Priority: 310
    Name: AllowAnyHTTPInbound

  • On the WS-VM1 page, choose Connect.

  • Under Native RDP, choose Select.

  • On the Native RDP page, choose Download RDP file
    and then open the file. Opening the RDP file opens the Remote Desktop Connection dialog box

  • On the Windows Security **dialog box, choose **More Choices and then choose Use a different account.

  • Enter the username as .\prime and the password as the secure password you chose in Step 3, and choose OK

  • When signed into the Windows Server virtual machine, right-click on the Start hint and then choose Windows PowerShell (Admin).

  • At the elevated command prompt, type the following command and press Enter. Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools

  • When the installation completes run the following command to change to the web server root directory. cd c:\inetpub\wwwroot\

  • Run the following command. Wget https://raw.githubusercontent.com/Azure-Samples/html-docs-hello-world/master/index.html -OutFile index.html

  • When signed into the Windows Server virtual machine, right-click on the Start hint and then choose Windows PowerShell (Admin).

  • At the elevated command prompt, type the following command and press Enter. Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools

  • At the elevated command prompt, type the following command and press Enter. Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools

  • When the installation completes run the following command to change to the web server root directory. cd c:\inetpub\wwwroot\

4. Deploy a Linux VM (Linux‑VM2)
Create the VM

  • Name: Linux-VM2

  • Resource Group: rg-alpha

  • Availability options: No infrastructure redundancy required

  • Image: Ubuntu Server 20.04 LTS

  • Size: Standard_D2s_v3

  • VM architecture: x64

  • Username: prime, Password: (your secure password)

  • Review the information and choose Create.

Add Monitoring Extension

  • After the VM deploys, open the VM properties page and choose Extensions + Applications under Settings

  • Choose Add and select the Network Watcher Agent for Linux. Choose Next and then choose Review and Create. Choose Create.

Deploy a web app with an SQL Database

  • In your browser, open a new browser tab and navigate to https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.web/web-app-sql-database

  • On the GitHub page, choose Deploy to Azure.

  • A new tab opens. If necessary, re-sign into Azure with the account that has Global Administrator privileges.

  • On the Basics page, select Edit template.

  • In the template editor, delete the contents of lines 158 to 174 inclusive and delete the “,” on line 157. Choose Save.

  • On the Basics page, provide the following information and choose Next.
    Subscription: Your subscription
    Resource Group: rg-alpha
    Region: East US
    Sku Name: F1
    Sku Capacity: 1
    Sql Administrator Login: prime
    Sql Administrator Login Password : [Select a unique secure password] P@ssw0rdP@ssw0rd

  • Review the information presented and select Create.

  • Review the information presented and select Create

  • After the deployment completes, choose Go to resource group.

Top comments (0)