Skip to Content
Azure上のLinux (Chinese Edition)
book

Azure上のLinux (Chinese Edition)

by Ned Bellavance, Chris Hayner
November 2025
Intermediate to advanced
130 pages
1h 11m
Chinese
O'Reilly Media, Inc.
Content preview from Azure上のLinux (Chinese Edition)

第7章. 在Azure上自动化 Linux部署

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

随着组织不断扩展应用程序和基础设施,手动部署与配置很快变得不切实际且易出错。为解决此问题,现代 DevOps 实践——GitOps、CI/CD、自动化及基础设施即代码——为实现一致、可重复且自动化的部署提供了框架。这些实践不仅关乎效率,更从根本上提升了 Microsoft Azure 上 Linux 工作负载的可靠性、可扩展性和安全性。

本章将探讨如何利用 Azure 自动化工具生态系统与集成方案,实现 Linux 应用程序的无缝部署与管理。内容涵盖:

基础设施即代码(IaC)

运用Azure Resource Manager (ARM)、Bicep、Terraform和Ansible将基础设施转化为版本控制代码

代码托管与自动化平台

通过 GitHub Actions 和 Azure DevOps 实现应用程序与基础设施的一致部署

应用交付模型

探索 Azure 应用服务、Azure 容器应用、AKS 和 Azure 虚拟机

Microsoft Copilot for Azure

借助人工智能驱动的自动化加速基础设施规划

基础设施即代码 (IaC)

IaC 允许您在人类可读的配置文件中定义基础设施,实现自动化、可重复的部署。IaC 的兴起与云计算的发展同步,云计算为 IaC 工具提供了统一的 API 接口。

Azure 支持多种 IaC 工具,每种工具都有其优势和潜在缺点。

Azure Resource Manager (ARM)

ARM 是 Azure 的部署与管理服务。ARM 模板采用 JSON 定义 Azure 资源及其配置。在功能与服务支持方面,ARM 模板堪称黄金标准。

尽管功能强大,ARM模板可能冗长且难以维护。手动编辑JSON具有挑战性,且ARM模板缺乏对常见编程功能的支持,例如内联注释和可重用模块。这些缺陷促使开发了Bicep作为简化的抽象层。

Bicep

Bicep是专用于部署Azure资源的领域特定语言。它与ARM模板保持完全兼容,但编写和管理更为便捷。其主要优势包括:

简化语法

比原始 ARM JSON 更简洁易读

模块化设计

促进复杂架构中可复用组件的应用

原生Azure集成

与 Azure 服务完全兼容

Bicep与ARM模板存在相同局限性,即仅支持Azure服务。若需更具云平台无关性的解决方案,Terraform可作为可行替代方案。

Terraform

Terraform 是多云基础设施即代码的行业标准。其声明式语法可统一定义 Azure 与多云资源。使用 Terraform 的主要优势包括:

跨Cloud兼容性

将基础设施部署至 Azure、亚马逊网络服务 (AWS)、谷歌云等平台

状态管理

追踪已部署资源,实现漂移检测与回滚

模块化配置

支持可复用模块,简化基础设施扩展

Terraform 通过 AzureRM 和 AzAPI 提供程序全面支持 Azure 服务。其中 AzAPI 提供程序尤其突出,使 Terraform 能从第一天起就支持 ARM 模板可用的所有服务和功能。

Ansible

与专注于基础设施部署的 ARM、Bicep 和 Terraform 不同,Ansible 在配置管理和应用程序部署领域表现卓越。Ansible 采用以剧本形式呈现的声明式配置,这些剧本通常存储在 Git ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

产品思维工程师 (Chinese Edition)

产品思维工程师 (Chinese Edition)

Drew Hoskins

Publisher Resources

ISBN: 0642572286668