[英]How to identify Azure resources with a newer API version
Let's say you've deployed an Azure solution consisting of multiple platform services (defined in bicep in this case) at some point time.假设您在某个时间部署了一个 Azure 解决方案,其中包含多个平台服务(在本例中在 bicep 中定义)。 To keep the solution up to date you want to identify when resources are released in a new API version.
为了使解决方案保持最新,您需要确定资源何时在新的 API 版本中发布。 Eg the initial deployment used this resource/API:
例如,初始部署使用此资源/API:
Microsoft.Storage/storageAccounts@2021-04-01
I'd like to identify that the current API version is 2021-08-01我想确定当前的 API 版本是 2021-08-01
The Bicep plug in in VS Code helps a bit, but I have to walk trough all resources (place cursor at API version - press CTRL + space to get a pop-up of API versions), which is a manual process. VS Code 中的 Bicep 插件有点帮助,但我必须遍历所有资源(将 cursor 置于 API 版本 - 按 CTRL + 空格键弹出 API 版本),这是一个手动过程。 -Is there a better way to use VS Code for this?
-有没有更好的方法来使用 VS Code?
Preferably I'd like to have a script (Azure CLI or other) which identifies newer API versions within a scope (eg subscription or resource groups).我最好有一个脚本(Azure CLI 或其他),它可以识别 scope(例如订阅或资源组)中较新的 API 版本。 Running this script on a regular basis, it will be easier to keep track of what versions are evolving from the original deploy.
定期运行此脚本,可以更轻松地跟踪从原始部署演变而来的版本。
A couple thoughts...几个想法...
it's not necessary to have the latest apiVersion - deprecation is rare and a long process.没有必要拥有最新的 apiVersion - 弃用是罕见的,而且是一个漫长的过程。 For anything that's "necessary" (security, performance) those are generally done in existing apiVersions.
对于任何“必要的”(安全性、性能),这些通常在现有的 apiVersions 中完成。 So maybe that helps with the urgency.
所以也许这有助于缓解紧迫感。 If you have features that are only available in a newer apiVersion, that's the time to move.
如果您拥有仅在较新的 apiVersion 中可用的功能,那就是移动的时候了。
the arm-ttk will check apiVersions on a template (not the resources in Azure but the code that deploys resources to azure. Here's the specific test: https://github.com/Azure/arm-ttk/blob/2022.03.16/arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent.test.ps1 . That will flag anything over 2 years old (and a few other scenarios around preview versions) so it may be possible to modify that to suit your needs. arm-ttk会检查模板上的apiVersions(不是Azure中的资源,而是将资源部署到azure的代码。具体测试如下: https://github.com/Azure/arm-ttk/blob/2022.03.16/ arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent.test.ps1 。这将标记任何超过 2 年的历史(以及预览版本周围的一些其他场景),因此可以修改它以满足您的需要.
Perhaps not precisely what you're looking for but does that help?也许不完全是您要找的东西,但这有帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.