如何部署和配置 Azure Monitor

发布: (2026年1月2日 GMT+8 03:31)
3 分钟阅读
原文: Dev.to

Source: Dev.to

准备 Azure 环境

  1. 创建资源组

    • 搜索 Resource GroupsCreate
    • 名称: rg-alpha
    • 地区: East US
    • 点击 Review + createCreate

    此资源组将容纳 Azure Monitor 将要监视的所有资源。

创建安全组(可选 – 实验室使用)

  1. 搜索 Azure Active Directory / Entra IDGroupsNew group
  2. 组类型: Security
  3. 名称: App Log Examiners
  4. 点击 Create

部署要监视的虚拟机

部署 Windows 虚拟机 (WS‑VM1)

  1. 搜索 Virtual MachinesCreate

  2. 基础信息

    • 名称: WS-VM1
    • 地区: East US
    • 镜像: Windows Server 2022 Datacenter
    • 大小: Standard_D4s_v3
    • 管理员用户名: prime
    • 密码: 你的安全密码
    • 入站端口: RDP (3389)
  3. 点击 Create 并等待部署完成。

  4. 部署完成后,选择 Go to resourceNetworking

    • 编辑默认的 RDP 规则:将 Source 设置为 My IP addressSave
    • 添加入站规则:
      • Source: Any
      • Destination port ranges: 310
      • Protocol: TCP
      • Action: Allow
      • Name: AllowAnyHTTPInbound
  5. 通过 RDP 连接:

    • 选择 ConnectNative RDPDownload RDP file
    • 在 Windows Security 对话框中,选择 More choicesUse a different account
    • 用户名: .\prime
    • 密码: 你的安全密码OK
  6. 在虚拟机内部,打开 Windows PowerShell (Admin) 并运行:

    Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools
    cd C:\inetpub\wwwroot
    Invoke-WebRequest https://raw.githubusercontent.com/Azure-Samples/html-docs-hello-world/master/index.html -OutFile index.html

部署 Linux 虚拟机 (Linux‑VM2)

  1. 搜索 Virtual MachinesCreate
  2. 基础信息
    • 名称: Linux-VM2
    • 资源组: rg-alpha
    • 可用性选项: No infrastructure redundancy required
    • 镜像: Ubuntu Server 20.04 LTS
    • 大小: Standard_D2s_v3
    • 架构: x64
    • 用户名: prime
    • 密码: 你的安全密码
  3. 点击 Review + createCreate
  4. 部署完成后,打开 Settings 下的 Extensions + Applications
  5. 添加 Network Watcher Agent for Linux 扩展:AddNextReview + createCreate

部署带 SQL 数据库的 Web 应用

  1. 打开模板仓库。
  2. 点击 Deploy to Azure
  3. 如有提示,请使用具有全局管理员权限的账户登录。
  4. Basics 页面,选择 Edit template
  5. 在编辑器中,删除 158‑174 行(包括这两行),并删除 157 行末尾的逗号。点击 Save
  6. Basics 页面提供所需参数,然后点击 Next
  7. 审核配置并点击 Create
  8. 部署完成后,选择 Go to resource group 查看新创建的 Web 应用和 SQL 数据库。
Back to Blog

相关文章

阅读更多 »

RGB LED 支线任务 💡

markdown !Jennifer Davishttps://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%...

Mendex:我为何构建

介绍 大家好。今天我想分享一下我是谁、我在构建什么以及为什么。 早期职业生涯与倦怠 我在 17 年前开始我的 developer 生涯……