azure-cli: Unable to create VM with standard security
Describe the bug
Hi there,
After upgrading to az v2.71.0, my az vm create commands fail with The value of parameter securityProfile.securityType is invalid..
After downgrading the cli via brew install --build-from-source azure-cli.rb with the file being taken from https://github.com/Homebrew/homebrew-core/blob/4ebae799157b908501142a9752101fd0e69722ba/Formula/a/azure-cli.rb the cli version is v2.70.0 and works properly with security type of Standard.
Related command
az vm create --name="az-cli-test" --image="MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest" --resource-group=<your RG here> --computer-name="ImageBuilder" --os-disk-delete-option=Delete --data-disk-delete-option=Delete --nic-delete-option=Delete --nsg-rule=NONE --license-type="Windows_Server" --accept-term --location="eastus" --size="Standard_F32s_v2" --security-type="Standard" --admin-username=<your user here> --admin-password=<your password here>
Errors
Command failed with The value of parameter securityProfile.securityType is invalid.
Issue script & Debug output
Debug output
DEBUG: cli.knack.cli: Command arguments: ['vm', 'create', '--name=********', '--image=MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest', '--resource-group=********', '--computer-name=ImageBuilder', '--os-disk-delete-option=Delete', '--data-disk-delete-option=Delete', '--nic-delete-option=Delete', '--nsg-rule=NONE', '--license-type=Windows_Server', '--accept-term', '--location=eastus', '--size=Standard_F32s_v2', '--security-type=Standard', '--admin-username=********', '--admin-password=********', '--debug']
DEBUG: cli.azure.cli.core.sdk.policies: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
DEBUG: cli.azure.cli.core.sdk.policies: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 757, in run
self._poll()
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 789, in _poll
raise OperationFailed("Operation failed or canceled")
azure.core.polling.base_polling.OperationFailed: Operation failed or canceled
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/vm/custom.py", line 1139, in create_vm
LongRunningOperation(cmd.cli_ctx)(client.begin_create_or_update(resource_group_name, deployment_name, deployment))
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 1076, in __call__
raise exception
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 1063, in __call__
result = poller.result()
^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 251, in result
self.wait(timeout)
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 270, in wait
raise self._exception # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 185, in _start
self._polling_method.run()
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 772, in run
raise HttpResponseError(response=self._pipeline_response.http_response, error=err) from err
azure.core.exceptions.HttpResponseError: (DeploymentFailed) At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Code: DeploymentFailed
Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Target: /subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ
Exception Details: (InvalidParameter) The value of parameter securityProfile.securityType is invalid.
Code: InvalidParameter
Message: The value of parameter securityProfile.securityType is invalid.
Target: securityProfile.securityType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
raise CLIError(ex.inner_exception.error.message)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OpeDEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 757, in run
self._poll()
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 789, in _poll
raise OperationFailed("Operation failed or canceled")
azure.core.polling.base_polling.OperationFailed: Operation failed or canceled
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/vm/custom.py", line 1139, in create_vm
LongRunningOperation(cmd.cli_ctx)(client.begin_create_or_update(resource_group_name, deployment_name, deployment))
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 1076, in __call__
raise exception
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 1063, in __call__
result = poller.result()
^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 251, in result
self.wait(timeout)
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 270, in wait
raise self._exception # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/_poller.py", line 185, in _start
self._polling_method.run()
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/core/polling/base_polling.py", line 772, in run
raise HttpResponseError(response=self._pipeline_response.http_response, error=err) from err
azure.core.exceptions.HttpResponseError: (DeploymentFailed) At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Code: DeploymentFailed
Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Target: /subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ
Exception Details: (InvalidParameter) The value of parameter securityProfile.securityType is invalid.
Code: InvalidParameter
Message: The value of parameter securityProfile.securityType is invalid.
Target: securityProfile.securityType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
raise CLIError(ex.inner_exception.error.message)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OperationFailed' object has no attribute 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
return cmd_copy.exception_handler(ex)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 112, in handle_template_based_exception
raise_subdivision_deployment_error(ex.response.internal_response.text, ex.error.code if ex.error else None)
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 104, in raise_subdivision_deployment_error
raise DeploymentError(error_message)
azure.cli.core.azclierror.DeploymentError: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
rationFailed' object has no attribute 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job
return cmd_copy.exception_handler(ex)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 112, in handle_template_based_exception
raise_subdivision_deployment_error(ex.response.internal_response.text, ex.error.code if ex.error else None)
File "/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 104, in raise_subdivision_deployment_error
raise DeploymentError(error_message)
azure.cli.core.azclierror.DeploymentError: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
ERROR: cli.azure.cli.core.azclierror: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
ERROR: cli.azure.cli.core.azclierror: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
ERROR: az_command_data_logger: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
ERROR: az_command_data_logger: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/********/resourceGroups/********/providers/Microsoft.Resources/deployments/vm_deploy_Ab3CzBhmNVo0tKDI2MUaMetgowTc7LrJ","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidParameter","target":"securityProfile.securityType","message":"The value of parameter securityProfile.securityType is invalid."}]}}
Expected behavior
The VM is created, as it does in v2.70.0.
Environment Summary
azure-cli 2.71.0
core 2.71.0
telemetry 1.1.0
Extensions:
image-copy-extension 0.2.13
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Python location '/opt/homebrew/Cellar/azure-cli/2.71.0/libexec/bin/python'
Config directory '/Users/mboris/.azure'
Extensions directory '/Users/mboris/.azure/cliextensions'
Python (Darwin) 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 42 (1 by maintainers)
Same issue with Azure PowerShell … $vm_config = Add-AzVMNetworkInterface -VM $vm_config -Id XXXX … New-AzVM -ResourceGroupName “rg1” -Location eastus -VM $vm_config
Security profile was never set up before. Explicitly setting the SecurityType does not help $vm_config = Set-AzVMSecurityProfile -VM $vm_config -SecurityType “Standard”
This is a critical regression.
Customer experience is not great and should be improved. Any plans on updating the error message and documentation to reflect the registration requirement for the Standard security type? https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-create
Any update guys? I see still issue exists, Azure PWSH is also impacted : https://stackoverflow.com/questions/79640272/problem-with-security-type-in-azure-powershell-virtual-machine
@matt-boris - We’re working towards removing the feature flag dependency in backend which will fix it for CLI as well in future. Will update the docs accordingly once the dependency is removed.
I thought this whole issue was about giving the user the ability to bypass any default that Azure decided on if they specified
--security-type="Standard".I’ve no need to use/test any other cases, as I figured the patch in the latest CLI version was to accept the user input bypassing Azure’s default behavior, apparently not.
This was quite a disruptive, breaking change that I’ll only consider fixed at this point because the docs were at least updated to note the feature flag requirement.
@matt-boris - gentle reminder.
@AjKundnani Thanks, the azure-cli command did the trick!
A few minutes later…
@codethief, please try registering using PowerShell or CLI.
set your subscription then run the below commands
It’s a severe issue that blocks customers to deploy VMs with standard security type.
So am I reading this issue as ‘wont fix’ by azure-cli team? This is absurd.
Thanks @USBAkimbo your suggestion worked and I am now able to deploy VMs from my pipeline again.
@USBAkimbo fwiw, adding the feature flag fixes this issue for now https://github.com/Azure/azure-cli/issues/31191#issuecomment-2784205683
@yagmurbaydogan @SergeyVartanov @nvzard - Same response as above, please do the needful to onboard to required feature registration.
@matt-boris - Please on-board subscription to feature flag
Microsoft.Compute\UseStandardSecurityTypefor bypassing Trusted launch as default experience and usingsecurityType = Standard.You can self-register the feature flag on subscription using PowerShell or CLI. Refer to Set up preview features in Azure subscription
Note: This is not a preview feature, it is implemented such a way to ensure users consciously bypass the foundational compute security offered by Trusted launch.
I am also facing the same issue. It broke my production deployments.
I’ve never used the
--security-typeflag before. This works with v2.70.0 but fails with v2.71.0