使用Trusted Launch参数创建Azure VM时遇错误求助
解决Azure VM/VMSS创建时的TrustedLaunch安全类型报错
你遇到的错误是因为所选的Azure库镜像强制要求虚拟机(VM)或虚拟机规模集(VMSS)使用TrustedLaunch安全类型,而代码中未配置该参数。
修改代码方案:
- 创建VM时,在虚拟机配置中添加
SecurityProfile并指定安全类型:
var vm = new VirtualMachine { // 保留你原有配置(如硬件、存储、网络等) SecurityProfile = new SecurityProfile { SecurityType = SecurityType.TrustedLaunch } };
- 创建VM Scale Set时,在虚拟机规模集的VM配置中添加对应安全配置:
var vmss = new VirtualMachineScaleSet { // 保留你原有配置(如SKU、升级策略等) VirtualMachineProfile = new VirtualMachineScaleSetVMProfile { // 保留你原有VM配置(如OS、存储等) SecurityProfile = new SecurityProfile { SecurityType = SecurityType.TrustedLaunch } } };
TrustedLaunch是Azure提供的安全启动机制,部分官方优化镜像会强制要求启用该类型,以此保障虚拟机启动过程的完整性与安全性。
内容的提问来源于stack exchange,提问作者Fabio Gonzalez
相关产品推荐
相关产品推荐

