Skip to content

Commit 2bc85ae

Browse files
{Compute} Add image deprecation status validation (#32688)
1 parent eb0633e commit 2bc85ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,15 @@ def _validate_generation_version_and_trusted_launch(cmd, namespace):
14521452
namespace.os_offer, namespace.os_sku)
14531453
vm_image_info = client.get(namespace.location, namespace.os_publisher, namespace.os_offer,
14541454
namespace.os_sku, os_version)
1455+
1456+
if vm_image_info.image_deprecation_status.image_state == 'ScheduledForDeprecation':
1457+
logger.warning(
1458+
'Warning: This image %s is scheduled for deprecation and will be blocked after %s.\n'
1459+
'VM / VMSS creation is allowed temporarily, but future deployments, redeployments, or '
1460+
'scale‑out operations may fail after this date.\n'
1461+
'Consider switching to a supported image now.', namespace.image,
1462+
vm_image_info.image_deprecation_status.scheduled_deprecation_time.strftime("%B %d, %Y"))
1463+
14551464
generation_version = vm_image_info.hyper_v_generation if hasattr(vm_image_info,
14561465
'hyper_v_generation') else None
14571466
features = vm_image_info.features if hasattr(vm_image_info, 'features') and vm_image_info.features else []

0 commit comments

Comments
 (0)