diff --git a/src/azure-cli/azure/cli/command_modules/vm/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/_validators.py index b7529b8f900..0086156951a 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_validators.py @@ -1311,6 +1311,15 @@ def _enable_msi_for_trusted_launch(namespace): namespace.assign_identity.append(MSI_LOCAL_ID) +def _validate_trusted_launch(namespace): + if not namespace.security_type or namespace.security_type.lower() != 'trustedlaunch': + return + + if not namespace.enable_vtpm or not namespace.enable_secure_boot: + logger.warning('It is recommended to specify "--enable-secure-boot True" and "--enable-secure-boot True"' + ' to receive the full suite of security features that comes with Trusted Launch.') + + def _validate_vm_vmss_set_applications(cmd, namespace): # pylint: disable=unused-argument if namespace.application_configuration_overrides and \ len(namespace.application_version_ids) != len(namespace.application_configuration_overrides): @@ -1382,6 +1391,7 @@ def process_vm_create_namespace(cmd, namespace): if namespace.secrets: _validate_secrets(namespace.secrets, namespace.os_type) + _validate_trusted_launch(namespace) _validate_vm_vmss_msi(cmd, namespace) if namespace.boot_diagnostics_storage: namespace.boot_diagnostics_storage = get_storage_blob_uri(cmd.cli_ctx, namespace.boot_diagnostics_storage) @@ -1586,6 +1596,7 @@ def process_vmss_create_namespace(cmd, namespace): if namespace.vm_sku and not namespace.image: raise ArgumentUsageError('usage error: please specify the --image when you want to specify the VM SKU') + _validate_trusted_launch(namespace) if namespace.image: if namespace.vm_sku is None: @@ -1675,6 +1686,7 @@ def process_vmss_create_namespace(cmd, namespace): _validate_vmss_create_nsg(cmd, namespace) _validate_vm_vmss_accelerated_networking(cmd.cli_ctx, namespace) _validate_vm_vmss_create_auth(namespace, cmd) + _validate_trusted_launch(namespace) _validate_vm_vmss_msi(cmd, namespace) _validate_proximity_placement_group(cmd, namespace) _validate_vmss_terminate_notification(cmd, namespace)