Optimize your Azure APIM deployments by leveraging the STv2 platform version. Here's a comprehensive guide on how to achieve this, specifically tailored for the Australia East region.

 apim STv2

Introduction

Azure API Management (APIM) offers different platform versions for your service deployments. Each version has distinct features and configurations. If you're leveraging Terraform or any other IaC tools for your infrastructure deployments and have run into the challenge of new instances defaulting to the older 'Version 1' platform, you're not alone. You might prefer to utilize the 'STv2' version for your new deployments, but the current implementation might not seem to offer a direct method to select this newer platform.

This article will walk you through the process of configuring your IaC Terraform scripts to ensure that all newly deployed instances of Azure APIMs utilize the 'STv2' platform version as the default. By the end of this tutorial, you'll have a clear understanding of the steps to follow, the best practices to observe, and how to implement specific coding examples in your Terraform scripts.

Understanding Azure APIM's Platform Versions

Before delving into the solution, it's crucial to understand how Azure APIM selects its platform version. Azure APIM does not have a direct configuration such as 'sku_size' or other properties that explicitly specify the platform version during APIM creation. Instead, the version is automatically selected based on your configuration settings. For a detailed understanding of these configurations, refer to this documentation.

Essentially, if you create an APIM without a Virtual Network, the newly created APIM will be based on Virtual Machine Scale Sets (VMSS), which corresponds to the 'STv2' PlatformVersion. On the other hand, creating an APIM within a Virtual Network will only allow for an 'STv2' VMSS-based APIM if specific requirements are met.

Here's a summary of the differences and details about each:

  1. Versions and Use:

    • stv1: This is an older version of the Azure API Management's compute platform.
    • stv2: This is the newer and recommended version of the compute platform. It offers more features and improvements compared to stv1. Most new instances created in service tiers other than the Consumption tier are hosted on the stv2 platform​​​​.
  2. Features and Enhancements:

    • stv2 provides enhanced service capabilities compared to stv1. It supports Azure Private Link and other advanced networking features​​.
  3. Migration and Retirement:

    • Existing instances on the stv1 platform can be migrated to stv2. This migration is encouraged as stv1 is scheduled for retirement in August 2024​​​​.
  4. Platform Versions:

    • Currently, there are three platform versions available: stv1, stv2, and mtv1. The mtv1 is used for the Consumption tier APIM, which relies on App service architecture, while stv1 and stv2 are available for other tiers like Developer, Basic, Standard, and Premium​​.
  5. Applicability:

    • stv2 is not directly related to the Basic v2 and Standard v2 tiers. It's a separate compute platform version applicable to Developer, Basic, Standard, and Premium tier service instances and serves as the successor to the stv1 platform​​.

In summary, stv2 is a more advanced and feature-rich version of the APIM compute platform, offering improved networking capabilities and other enhancements over stv1. With the impending retirement of stv1, migration to stv2 is advisable for enhanced service capabilities.

Requirements for Creating 'STv2' VMSS-Based APIM within Virtual Network

Creating an 'STv2' VMSS-based APIM within a Virtual Network comes with specific prerequisites. These include:

  1. The APIM must be configured with your own public IPv4 address. You can follow the guide provided here for configuration instructions.
  2. The APIM can also be configured with the Availability Zone following this guide.
  3. The new APIM service must be created using the Azure portal, or by specifying API version 2021-01-01-preview or later using the Azure REST API, ARM template, etc.

Failure to meet these requirements will result in the newly created APIM being Cloud Service based, which is the 'STv1' version.

Configuring Your Terraform Scripts for 'STv2' APIM Deployment

To achieve the 'STv2' APIM deployment with your Terraform scripts, you'll need to configure the public_ip_address_id or zones if you are creating the APIM within a Virtual Network.

A comprehensive guide on using Azure APIM with Virtual Networks is available here. It provides a detailed breakdown of all the necessary steps and configurations required to achieve your goal.

To find more information please follow this detalied guide from MS: https://learn.microsoft.com/en-us/azure/api-management/api-management-using-with-vnet?tabs=stv2

Conclusion

Deploying Azure APIM instances using the STv2 platform infrastructure can provide significant benefits in your continuous deployment cycle. Although there is no direct method to select this platform with Terraform or any other IaC tools , the above guide offers a proven workaround. By understanding the fundamental workings of Azure APIM's platform version selection and adjusting your configurations accordingly, you can make sure that all your new APIM instances utilize the 'STv2' platform version by default.

Please keep in mind that the requirements mentioned above apply specifically to deployments within a Virtual Network. If you're deploying APIMs without a Virtual Network, the default will automatically be the 'STv2' version.

By harnessing the power of Terraform and Azure's flexible platform versions, you can enhance the scalability, reliability, and efficiency of your infrastructure service deployments.