适用于 Windows 虚拟机的 Azure CLI 示例Azure CLI Samples for Windows virtual machines

下表包含指向使用部署 Windows 虚拟机的 Azure CLI 生成的 bash 脚本的链接。The following table includes links to bash scripts built using the Azure CLI that deploy Windows virtual machines.

ScriptScript 说明Description
创建虚拟机Create virtual machines
创建虚拟机Create a virtual machine 使用最小配置创建 Windows 虚拟机。Creates a Windows virtual machine with minimal configuration.
创建完全配置的虚拟机Create a fully configured virtual machine 创建资源组、虚拟机以及所有相关资源。Creates a resource group, virtual machine, and all related resources.
创建高度可用的虚拟机Create highly available virtual machines 使用高度可用且负载均衡的配置创建多个虚拟机。Creates several virtual machines in a highly available and load balanced configuration.
创建 VM 并运行配置脚本Create a VM and run configuration script 创建一个虚拟机,并使用 Azure 自定义脚本扩展安装 IIS。Creates a virtual machine and uses the Azure Custom Script extension to install IIS.
创建 VM 并运行 DSC 配置Create a VM and run DSC configuration 创建一个虚拟机,并使用 Azure Desired State Configuration (DSC) 扩展来安装 IIS。Creates a virtual machine and uses the Azure Desired State Configuration (DSC) extension to install IIS.
管理存储Manage storage
从 VHD 创建托管磁盘Create managed disk from a VHD 从作为 OS 磁盘的专用 VHD 或从作为数据磁盘的数据 VHD 创建托管磁盘。Creates a managed disk from a specialized VHD as an OS disk or from a data VHD as data disk.
从快照创建托管磁盘Create a managed disk from a snapshot 从快照创建托管磁盘。Creates a managed disk from a snapshot.
将托管磁盘复制到相同或不同的订阅Copy managed disk to same or different subscription 将托管磁盘复制到相同或不同的订阅,但与父级托管磁盘位于同一区域。Copies managed disk to same or different subscription but in the same region as the parent managed disk.
将快照作为 VHD 导出到存储帐户Export a snapshot as VHD to a storage account 将托管快照作为 VHD 导出到不同区域中的存储帐户。Exports a managed snapshot as VHD to a storage account in different region.
将托管磁盘的 VHD 导出到存储帐户Export the VHD of a managed disk to a storage account 将托管磁盘的基础 VHD 导出到不同区域中的存储帐户。Exports the underlying VHD of a managed disk to a storage account in different region.
将快照复制到相同或不同的订阅中Copy snapshot to same or different subscription 将快照复制到相同或不同的订阅,但与父级快照位于同一区域。Copies snapshot to same or different subscription but in the same region as the parent snapshot.
网络虚拟机Network virtual machines
保护虚拟机之间的网络流量Secure network traffic between virtual machines 创建两个虚拟机、所有相关资源以及内部和外部网络安全组 (NSG)。Creates two virtual machines, all related resources, and an internal and external network security groups (NSG).
保护虚拟机安全Secure virtual machines
加密 VM 和数据磁盘Encrypt a VM and data disks 创建 Azure Key Vault、加密密钥和服务主体,然后对 VM 进行加密。Creates an Azure Key Vault, encryption key, and service principal, then encrypts a VM.
监视虚拟机Monitor virtual machines
使用 Azure Monitor 监视 VMMonitor a VM with Azure Monitor 创建一个虚拟机,安装 Log Analytics 代理,并在 Log Analytics 工作区中注册该 VM。Creates a virtual machine, installs the Log Analytics agent, and enrolls the VM in a Log Analytics workspace.