简体   繁体   English

如何用较新的API版本识别Azure资源

[英]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...几个想法...

  1. 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 中可用的功能,那就是移动的时候了。

  2. 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.

相关问题 Azure资源如何获取最新的API版本 - How to get the newest API version of Azure Resources 如何识别 Azure 虚拟机的驱动器及其在 Azure 门户中的显示方式? - How to identify drive of Azure Virtual Machine with how it is shown at Azure Portal? Azure传送门:Application Insights——如何识别请求者的IP地址 - Azure Portal: Application Insights - How to Identify Requestor's IP Address Azure webapp:如何更新Python版本? - Azure webapp: How to update Python version? 如何使用 Terraform 中的循环来部署 2 个不同的 azure 资源 - how to use Loops in Terraform to deploy 2 different azure resources 使用 kube.netes 中特定 API 版本查询所有对象/资源列表的命令 - Command to query list of all objects/resources using a specific API version in kubernetes 使用 C# 列出 Azure 资源所需的确切权限\操作 rest API - Exact Permissions\actions needed to List Azure Resources using C# rest API 如何在 Azure 资源组中获取所有没有标签的 Azure 资源,不包括隐藏标签 - How to get all Azure Resources without tags in a Azure Resource Group excluding Hidden tags 我在 ADO 管道中使用 Azure Bicep 生成了资源。 需要创建一个新的管道,用代码填充资源。 不确定如何 - I've generated resources using Azure Bicep in ADO pipelines. Need to make a new pipeline that will populate the resources with code. Not sure how Azure DevOps PS REST API:没有为“PUT”请求提供 api 版本。 该版本必须作为接受的一部分提供 header - Azure DevOps PS REST API : No api-version was supplied for the \"PUT\" request. The version must be supplied either as part of the Accept header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM