Azure 市场虚拟机镜像认证
本指南为 Azure 市场 ISV(独立软件供应商)介绍虚拟机镜像认证工具,认证流程,认证失败的解决方案等。
本文中的 Azure 市场作用范围均指中国,“镜像”或“映像”表示同一含义。
1. 认证工具的下载、安装和使用
Azure 镜像认证工具可以用于对 Windows VM 或 Linux VM 进行认证。它通过 PowerShell 连接到基于 Windows 的 VM,通过 SSH.Net 连接到 Linux VM,然后对 VM 操作系统进行检测并认证。它确保 VM 镜像与 Microsoft Azure 兼容,它会验证 VHD 镜像是否满足指南的要求,该工具的输出是一份兼容性报告。
认证工具软件包需要安装在 Windows 操作系统上,这个 Windows 既可以是本地 Windows,也可以位于Azure 平台上。对于 Linux VM,认证工具通过 TCP 端口号 22 进行连接和验证,22 端口号缺省是开放的,不需要您进行设置;对于 Windows VM,认证工具通过 TCP 端口号 5986 进行连接。
完整的认证过程如下:
- 首先,在 Microsoft 下载站点下载认证工具到 Windows 平台。
- 准备好被认证的 Linux VM 或 Windows VM。 Linux VM不需要特别设置;Windows VM 需要进行特别设置以满足验证需要,请参考下面的 Windows VM 特别设置。
- 打开认证工具,并单击“启动新测试”按钮。
- 在“测试信息”屏幕中,为测试运行输入名称。
- 选择 VM 是处于 Linux 还是 Windows 上。 根据所选内容,选择后续选项。
- 为基于 Linux 或 Windows 的 VM 镜像选择了正确的选项之后,选择“测试连接”以确保 SSH.Net 或 PowerShell 具有可用于测试的有效连接。 建立连接之后,按“下一步”以启动测试。
- 测试完成时,将收到每个测试元素的结果(通过/失败/警告)。 如果任何测试失败,不会认证镜像。 如果发生这种情况,请查看要求并作出任何必要更改。自动测试后,将通过调查表屏幕要求用户提供有关 VM 镜像的其他输入。 填写这些问题,并选择“下一步”。
- 最后,除下载调查表答案外,还可下载已执行的测试用例的测试结果和日志文件,并将结果保存在与 VHD 相同的容器中。
Windows VM 特别设置:
设置 TCP 端口号 5986。 在 Azure Portal中浏览 "资源组 -> {虚拟机所在资源组} -> {NSG name} -> 入站安全规则",如下图所示:
下载如下三个文件到 VM 目录 C:\winRM
a. https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/201-vm-winrm-windows/ConfigureWinRM.ps1 b. https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/201-vm-winrm-windows/makecert.exe c. https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/201-vm-winrm-windows/winrmconf.cmd
以管理员权限在 VM 上打开 PowerShell,然后执行类似如下指令:
ConfigureWinRM.ps1 testvm.chinaeast.cloudapp.chinacloudapi.cn
部分 Windows Server 无法运行以上指令,请参考 Windows PowerShell 执行策略,并运行如下指令:
Powershell -ExecutionPolicy Unrestricted -file ConfigureWinRM.ps1 40.73.115.226
2. 认证中发现的问题及解决方案
通过认证工具认证后,VM 镜像才能发布到 Azure 市场,在发布到 Azure 市场的过程中,也会有对于镜像的再次的认证审查过程。
认证内容主要包含两部分,“Execute Tests” 和 “Qustionnaire”,“Execute Tests” 主要是认证程序自动检查部分,“Qustionnaire” 主要是发布者手工检查部分,下面首先对“Execute Tests” 部分进行说明,后续 “Qustionnaire” 部分会进行追加。
2.1 基于 Centos 的认证
2.1.1 “Execute Tests” 部分问题和解决方法
名称 | 描述 | 解决方法 |
---|---|---|
Bash History | Bash history files should be cleared before creating the VM image | $ history -c #执行bash命令,清空所有历史记录 |
Linux Agent Version | Azure Linux Agent 2.2.10 and above should be installed | $ sudo yum install python-pyasn1 WALinuxAgent; sudo systemctl enable waagent(For 7.0 and above) 或参考为 Azure 准备基于 CentOS 的虚拟机 |
Required Kernel Parameters | Verifiles the following kernel parameters are set console=ttyS0,earlyprintk=ttyS0,rootdelay=300 | 对 CentOS7 及以上版本,编辑 /etc/default/grub 文件,修改其中的 GRUB_CMDLINE_LINUX 参数例如: "rootdelay=300 console=ttyS0 earlyprintk=ttyS0",然后运行如下命令重新生成grub配置并重启:$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg; reboot。对 CentOS7 以下版本,编辑 /etc/grub.conf 文件,修改其中的 rd_NO_MD SYSFONT 参数例如: "rootdelay=300 console=ttyS0 earlyprintk=ttyS0",然后重启:reboot。 或参考为 Azure 准备基于 CentOS 的虚拟机 |
Swap Partition on OS Disk | Verifies that no Swap partitions are created on the OS disk | 请删除系统自带的 Swap 分区,如果系统需要 Swap 分区,请按照如下方法设置: 修改/etc/waagent.conf文件配置,例如:“ResourceDisk.EnableSwap=y”以及“ResourceDisk.SwapSizeMB=2048”。或参考为 Azure 准备基于 CentOS 的虚拟机 |
Root Partition on OS Disk | It is recommended that a single root partition is created for the os disk | 根目录应该在操作系统所在的磁盘上,请确认 |
OpenSSL Version | OpenSSL Version should be >=0.9.8 | 请到如下网站下载 Openssl 的更高版本的软件包并安装:Openssl |
Python Version | Python version 2.6+ is highly recommended | 请到如下网站下载 Python 更高版本的软件包并安装: Python |
Client Alive Interval | It is recommended to set ClientAliveInterval to 180.On the application need,it can be set between 30 to 235.If you are enabling the SSH for your end users this value must be set as explained | 编辑 /etc/ssh/sshd_config 文件,修改其中的参数例如:“ClientAliveInterval 180” |
OS Architecture | Only 64-bit operating system should be supported | 请改用64位操作系统 |
Security threats | Identifies OS with recent high profile vulnerability that may need patching.Ignore warning if system was pathched as appropriate | 可以更新安全补丁:sudo yum --security update,或参考how to install security patches in Centos |
2.2 基于 Ubuntu 的认证
2.2.1 “Execute Tests” 部分问题和解决方法
名称 | 描述 | 解决方法 |
---|---|---|
Bash History | Bash history files should be cleared before creating the VM image | $ history -c #执行bash命令,清空所有历史记录 |
Linux Agent Version | Azure Linux Agent 2.0.8 and above should be installed | $ sudo apt-get update; sudo apt-get install walinuxagent 或参考为 Azure 准备 Ubuntu 虚拟机 |
Required Kernel Parameters | Verifiles the following kernel parameters are set console=ttyS0,earlyprintk=ttyS0,rootdelay=300 | 编辑 /etc/default/grub 文件,修改其中的 GRUB_CMDLINE_LINUX 参数例如: "rootdelay=300 console=ttyS0 earlyprintk=ttyS0 rootdelay=300",然后运行如下命令重新生成grub配置:**$ sudo update-grub **。或参考为 Azure 准备 Ubuntu 虚拟机。 |
Swap Partition on OS Disk | Verifies that no Swap partitions are created on the OS disk | 请删除系统自带的 Swap 分区,如果系统需要 Swap 分区,请按照如下方法设置: 修改/etc/waagent.conf文件配置,例如:“ResourceDisk.EnableSwap=y”以及“ResourceDisk.SwapSizeMB=2048” |
Root Partition on OS Disk | It is recommended that a single root partition is created for the os disk | 根目录应该在操作系统所在的磁盘上,请确认 |
OpenSSL Version | OpenSSL Version should be >=0.9.8 | 请到如下网站下载 Openssl 的更高版本的软件包并安装:Openssl |
Python Version | Python version 2.6+ is highly recommended | 请到如下网站下载 Python 更高版本的软件包并安装:Python |
Client Alive Interval | It is recommended to set ClientAliveInterval to 180.On the application need,it can be set between 30 to 235.If you are enabling the SSH for your end users this value must be set as explained | 编辑 /etc/ssh/sshd_config 文件,修改其中的参数例如:“ClientAliveInterval 180” |
OS Architecture | Only 64-bit operating system should be supported | 请改用64位操作系统 |
Security threats | Identifies OS with recent high profile vulnerability that may need patching.Ignore warning if system was pathched as appropriate | 请更新升级:sudo apt-get update && sudo apt-get dist-upgrade,并请参考 Ubuntu security notices |
2.3 基于 Windows 的认证
某些 Windows 软件或服务不支持在 Microsoft Azure 虚拟机环境(服务架构)中运行,具体请参考 Microsoft Azure 虚拟机的 Microsoft 服务器软件支持。
2.3.1 “Execute Tests” 部分问题和解决方法
名称 | 描述 | 解决方法 |
---|---|---|
OS Architecture | Azure supports 64bit Operationg System Only | 目前仅支持64位系统,另请参考准备好要上传到 Azure 的 Windows VHD 或 VHDX的 “备注” 部分 |
User account dependency | Application execution should not have dependency on administrator account | 您的系统运行请不要依赖于管理员账号 |
Failover Cluster | Windows Server Failover Clustering feature is not yet supported,Application should not have dependency on this feature | 请参考Windows Server 中的故障转移群集中的故障转移群集 PowerShell Cmdlet等,利用 "Get-Cluster"等命令行确认虚机中是否安装有Failover系统 |
IPV6 | IPV6 is not yet supported in the Azure environment, Application should not have dependency on this feature | Azure 中的 IP 地址类型和分配方法 |
DHCP | Dynamic Host Configuration Protocal Server role is not yet supported.Application should not have dependency on this feature. | Azure拥有自己的一套虚拟网络管理模式,DHCP在Azure当中不适用。请参考 虚拟网络 |
Hyper-V | Hyper-V Server role is not yet supported. Application should not have dependency on this feature. | 虚拟机内部不能再安装 hyper-v,可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装了 hyper-v,具体也请参考 Install the Hyper-V role on Windows Server 2016 |
Remote Access | Remote Access(Direct Access)Server role is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
Rights Management Services | Rights Management Services,Server role is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
Windows Deployment Services | Windows Deployment Services,Server role is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
BitLocker Drive Encryption | BitLocker Drive Encryption not supported on the operating system hard disk,may be used on data disks. | 请在 “Control Panel -> System and Security ->BitLocker Drive Encryption"中查看 |
Internet Storage Name Server | Internet Storage Name Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看iSNS是否安装 |
Multipath I/O | Multipath I/O.Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
Network Load Balancing | Network Load Balancing,Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
Peer Name Resolution Protocol | Peer Name Resolution Protocol,Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
SNMP Services | SNMP Services feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |
Storage Manager for SANs | Storage Manager for SANs,Server feature is not yet supported.Application should not have dependency on this feature. | 目前不支持 “Storage Manager for SANs” |
Windows Internet Name Service | Windows Internet Name Service, Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看 WINS 是否安装 |
Wireless LAN Service | Wireless LAN Service,Server feature is not yet supported.Application should not have dependency on this feature. | 可以在PowerShell中用 “Get-WindowsFeature” 查看是否安装 |