虚拟机不应使用预览映像。 此规则检查“imageReference”下的以下属性,如果其中任一属性包含字符串“preview”,则失败:
- 提供
- sku
- 版本
请在 Bicep 配置文件中使用以下值自定义规则设置:
use-stable-vm-image
以下示例未通过此测试。
param location string = resourceGroup().location
resource vm 'Microsoft.Compute/virtualMachines@2024-03-01' = {
name: 'virtualMachineName'
location: location
properties: {
storageProfile: {
imageReference: {
offer: 'WindowsServer-preview'
sku: '2019-Datacenter-preview'
version: 'preview'
}
}
}
}
可以使用不包含 imageReference 中的字符串 preview
的图像来修复此问题。
param location string = resourceGroup().location
resource vm 'Microsoft.Compute/virtualMachines@2024-03-01' = {
name: 'virtualMachineName'
location: location
properties: {
storageProfile: {
imageReference: {
offer: 'WindowsServer'
sku: '2019-Datacenter'
version: 'latest'
}
}
}
}
有关 Linter 的详细信息,请参阅使用 Bicep Linter。