Azure / azure-cli

Azure Command-Line Interface
MIT License
4k stars 2.98k forks source link

Cannot create a flexible scale set with a Windows Server Core image #21504

Open MatisseHack opened 2 years ago

MatisseHack commented 2 years ago

Describe the bug

It seems to be impossible to create a VMSS using flexible orchestration mode and a Windows Server Core image (e.g. MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition-core-smalldisk:latest). It seems that the image enables hotpatching by default and there is no way to get hotpatching to work with flexible scale sets.

Command Name az vmss create

Errors:

{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n  \"error\": {\r\n    \"code\": \"InvalidParameter\",\r\n    \"message\": \"EnableHotpatching cannot be set to true. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'.\",\r\n    \"target\": \"windowsConfiguration.patchSettings.enableHotpatching\"\r\n  }\r\n}"}]}}

To Reproduce:

Run the following command (some common parameters have been left off for brevity):

az vmss create \
--orchestration-mode Flexible \
--image MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition-core-smalldisk:latest \
--vm-sku Standard_B1ms

After receiving an error, I tried manually setting --patch-mode. Unfortunately --patch-mode AutomaticByPlatform is documented as not working, so I tried using --patch-mode Manual, which didn't solve the original issue and gave a more cryptic error message: 'windowsConfiguration'

I was able to solve the 'windowsConfiguration' error by adding a few more parameters:

az vmss create \
--orchestration-mode Flexible \
--image MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition-core-smalldisk:latest \
--vm-sku Standard_B1ms \
--patch-mode Manual \
--enable-auto-update false \
--enable-agent true

The original error persisted though.

Expected Behavior

Environment Summary

macOS-12.2.1-x86_64-i386-64bit, Darwin 21.3.0
Python 3.10.2
Installer: HOMEBREW

azure-cli 2.34.0

Additional Context

I was able to get the above commands to work when I switched the VM SKU to Standard_DS1_v2, but the resulting scale set was broken. It could not create new VMs so scaling up would always silently fail (I assume for the same reason as above). Ideally using different VM SKUs would fail in a consistent manner.

yonzhan commented 2 years ago

Compute

pl4nty commented 1 year ago

With a uniform vmss and PatchingMode: AutomaticByPlatform, I'm seeing an error about a feature that requires manual approval:

The property 'windowsConfiguration.patchSettings.patchMode' is not valid because the 'Microsoft.Compute/InGuestAutoPatchVmssUniformPreview' feature is not enabled for this subscription.

Seems to be fixed with a flexible vmss though

Bouke commented 1 year ago

Using terraform, I can only create uniform orchestrations and I'm getting the following unhelpful error message:

compute.VirtualMachineScaleSetsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The property 'windowsConfiguration.patchSettings.patchMode' is not valid because the 'Microsoft.Compute/InGuestAutoPatchVmssUniformPreview' feature is not enabled for this subscription." Target="windowsConfiguration.patchSettings.patchMode"

JoVuon commented 1 year ago

Using terraform, I can only create uniform orchestrations and I'm getting the following unhelpful error message:

compute.VirtualMachineScaleSetsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The property 'windowsConfiguration.patchSettings.patchMode' is not valid because the 'Microsoft.Compute/InGuestAutoPatchVmssUniformPreview' feature is not enabled for this subscription." Target="windowsConfiguration.patchSettings.patchMode"

I'm facing the same issue. Setting 'upgrade_mode = "Manual"' doesn't fix it. Also for the current provider (ver 3.71.0), there's no explicite patchMode setting to override.

michasacuer commented 5 months ago

Have the same issue with terraofrm. @JoVuon, @Bouke did you fix your issue?