简体   繁体   English

Azure Bicep/ARM 推荐使用的 API 版本(预览版与稳定版)

[英]Azure Bicep/ARM recommended API Version to use (Preview vs Stable)

I am working on Azure Bicep/ARM templates, I would like to know the Safe/recommended approach to use API versions on resource providers while creating templates in a big organization where multiple teams are going to use.我正在研究 Azure Bicep/ARM 模板,我想知道在多个团队将要使用的大型组织中创建模板时,在资源提供者上使用 API 版本的安全/推荐方法。

If we declare a resource type and use API version, we get lot of options in terms of Preview vs stable version.如果我们声明资源类型并使用 API 版本,我们会在预览版和稳定版方面获得很多选择。 As we always know that Stable version is recommended but most cases it looks way too old and previews look latest.我们一直都知道推荐使用稳定版,但大多数情况下它看起来太旧而且预览看起来是最新的。

In the below screenshot for SQL server resource, Preview version looks latest and stable heads to 2014 which may lead to compromise on latest features在下面的 SQL Server 资源屏幕截图中,预览版看起来是 2014 年最新且稳定的版本,这可能会导致对最新功能的妥协

Azure SQL API 版本 So, how can we decide on the API version which is stable/safe but cover latest features without breaking changes那么,我们如何确定稳定/安全但涵盖最新功能而又不破坏更改的 API 版本

resource sqlServer 'Microsoft.Sql/servers@2021-11-01-preview' = {
  name: serverName
  location: location
  tags: tags
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    version: version
    publicNetworkAccess: 'Enabled'
    administratorLogin: adminUserName
    administratorLoginPassword: administratorLoginPassword
  }
}

You will quickly find that when you start working with ARM templates you will need to use a lot of different API versions, in fact finding the API combination for each resource can be like navigating a labyrinth sometimes since what works for one resource type might not work for another and you need to find the combination that works for all and believe me sometimes this is far from trivial, so do not be mistaken and simply think you can stick to the same API version for all resources.您会很快发现,当您开始使用 ARM 模板时,您将需要使用许多不同的 API 版本,实际上,为每种资源查找 API 组合有时就像在迷宫中导航,因为适用于一种资源类型的方法可能不起作用对于另一个,你需要找到对所有人都有效的组合,相信我有时这远非微不足道,所以不要误会,只是认为你可以对所有资源坚持相同的 API 版本。

One way of doing this I found helpful is to create a resource of the same time in the Azure Portal and then download the template from there and see what API version they use, this has served me well many times.我发现这样做很有帮助的一种方法是在 Azure 门户中同时创建一个资源,然后从那里下载模板并查看他们使用的 API 版本,这对我很有帮助。

Some guidance you can use...您可以使用的一些指导...

  • Use the latest non-preview apiVersion unless there is a feature you need that's only available in a newer/preview version (this will be true for SQL)使用最新的非预览版 apiVersion 除非有您需要的功能仅在较新/预览版中可用(这对于 SQL 来说是正确的)
  • You don't need to upgrade your apiVersion unless there's a feature you need in the new version.除非新版本中有您需要的功能,否则您无需升级 apiVersion。 It doesn't hurt to revisit this every year or so to see if there are new capabilities available (SQL example again) - but aside from new features there's no reason you always need to be on the "latest"每年左右重新审视一下,看看是否有可用的新功能(再次是 SQL 示例)并没有什么坏处 - 但除了新功能之外,您没有理由总是需要处于“最新”状态
  • new apiVersions are more about functionality and schema changes than they are about "stability" - as Matt Douhan mentioned, if there is an apiVersion that's publicly available (ie public preview) its supported and considered "stable".新的 apiVersions 更多的是关于功能和架构更改,而不是关于“稳定性”——正如 Matt Douhan 所提到的,如果有一个公开可用的 apiVersion(即公共预览版),它支持并被认为是“稳定的”。

HTH高温高压

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM