Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Compute} az vm/vmss create: Add warning log to recommend users to specify the --enable-secure-boot True and --enable-vtpm True when the --security-type used by the VM/VMSS creation is TrustedLaunch #23289

Merged
merged 6 commits into from
Jul 22, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,16 @@ def _enable_msi_for_trusted_launch(namespace):
namespace.assign_identity.append(MSI_LOCAL_ID)


def _validate_trusted_launch(namespace):
if not namespace.security_type:
return

if namespace.security_type.lower() == 'trustedlaunch' and \
(namespace.enable_vtpm is not True or namespace.enable_secure_boot is not True):
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
logger.warning('Please set --enable-secure-boot to True and --enable-vtpm to True in order to receive the full'
' suite of security features that comes with Trusted Launch.')
Jing-song marked this conversation as resolved.
Show resolved Hide resolved


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):
Expand Down Expand Up @@ -1382,6 +1392,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)
Expand Down Expand Up @@ -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)
zhoxing-ms marked this conversation as resolved.
Show resolved Hide resolved
_validate_vm_vmss_msi(cmd, namespace)
_validate_proximity_placement_group(cmd, namespace)
_validate_vmss_terminate_notification(cmd, namespace)
Expand Down