How to check if an Azure Marketplace image is marked for deprecation

When working within the cloud you need to understand and plan for services or functionality that might be deprecated.  One important aspect to keep an eye on is the deprecation status of Azure Marketplace images. 

Deprecated images can pose risks such as lack of support, security vulnerabilities, and incompatibility with newer services. 

This post will guide you through the process of determining whether an Azure Marketplace image is marked for deprecation using PowerShell commands.

Why Monitor Azure Marketplace Image Deprecation?

Images in Azure Marketplace are periodically updated, and older versions may be marked for deprecation. When an image is deprecated it is often removed from the Azure Marketplace, meaning it won’t be available for use anymore.  

It’s important to keep an eye on when an image will be deprecated so you have an understand of when it might not be available anymore. So you can plan accordingly. 

Sometimes images are deprecated and not removed from the Marketplace meaning they are still available for use, however, they might not be kept updated date so are open to security threats.  Also using deprecated images might lead to you operating in a non-supported environment, meaning if issues occur you won’t receive any technical support. 

Finding the SKU Name

Before you can check the deprecation status of an image, you need to identify the SKU name. If you don’t know the SKU name, use the following command to find all relevant images. For example, to search for Windows Server 2012 images in the West US 3 region, you can use this command:

$Location = "westus3"
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$Wildcard = "2012"

Get-AzVMImageSku -Location $Location -PublisherName $PublisherName -Offer $Offer | Where-Object { $_.Skus -like "*$Wildcard*" }
Get-AzVMImageSKU output

Finding the Versions of a Specific SKU

Once you have identified the SKU name, the next step is to find the available image versions. For example, to find all versions of the Windows Server 2012 R2 Datacenter SKU, you can use:

$Location = "westus3"
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$Sku = "2012-R2-Datacenter"

Get-AzVMImage -Location $Location -PublisherName $PublisherName -Offer $Offer -Sku $Sku
Get-AzVMimage output

Checking the Deprecation Status

After identifying the version of the image you want to check, you can find out if and when an image is going to be deprecated by running this command:

$Location = "westus3"
$PublisherName = "MicrosoftWindowsServer"
$Offer = "WindowsServer"
$Sku = "2012-R2-Datacenter"
$Version = "9600.21620.231004"

Get-AzVMImage -Location $Location -PublisherName $PublisherName -Offer $Offer -Sku $Sku -Version $Version | Select-Object -ExpandProperty "ImageDeprecationStatus"
Get-AZVMImage deprecation output

Conclusion

Monitoring the deprecation status of Azure Marketplace images is a vital part of maintaining a secure and up-to-date cloud environment. By using the PowerShell commands provided in this guide, you can efficiently identify the deprecation status of any image, ensuring you remain proactive in managing your Azure resources.

Keep these steps handy and incorporate them into your regular cloud management routines to avoid any surprises related to deprecated images.