Skip to content

Commit c07e25a

Browse files
authored
[Compute] Fix #28397: az vm create: Fix creating VM with --security-type Standard (#28409)
1 parent 33f5b24 commit c07e25a

3 files changed

Lines changed: 1622 additions & 620 deletions

File tree

src/azure-cli/azure/cli/command_modules/vm/_validators.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ def trusted_launch_set_default(namespace, generation_version, features):
13521352
features_security_type = item.value
13531353
break
13541354

1355-
from ._constants import UPGRADE_SECURITY_HINT
1355+
from ._constants import UPGRADE_SECURITY_HINT, COMPATIBLE_SECURITY_TYPE_VALUE
13561356
if generation_version == 'V1':
13571357
logger.warning(UPGRADE_SECURITY_HINT)
13581358

@@ -1361,14 +1361,15 @@ def trusted_launch_set_default(namespace, generation_version, features):
13611361
if namespace.security_type is None:
13621362
namespace.security_type = 'TrustedLaunch'
13631363

1364-
if namespace.enable_vtpm is None:
1365-
namespace.enable_vtpm = True
1364+
if namespace.security_type != COMPATIBLE_SECURITY_TYPE_VALUE:
1365+
if namespace.enable_vtpm is None:
1366+
namespace.enable_vtpm = True
13661367

1367-
if namespace.enable_secure_boot is None:
1368-
namespace.enable_secure_boot = True
1368+
if namespace.enable_secure_boot is None:
1369+
namespace.enable_secure_boot = True
13691370
else:
13701371
if namespace.security_type is None:
1371-
namespace.security_type = 'Standard'
1372+
namespace.security_type = COMPATIBLE_SECURITY_TYPE_VALUE
13721373
logger.warning(UPGRADE_SECURITY_HINT)
13731374

13741375

0 commit comments

Comments
 (0)