Azure-不允许Arm模板修改现有资源 [英] Azure - do not allow Arm template to modify existing resources

查看:78
本文介绍了Azure-不允许Arm模板修改现有资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个arm模板,该模板在单个资源组中配置了很少的资源.然后更改其中一些资源(针对不同资源组更改定价层).

I have arm template that provisions few resources in a single resource group. Some of those resources are then altered (pricing tiers are being changed for different resource groups).

例如,在我的手臂模板中,Sql Database最初是为S1性能提供的,然后由用户扩展到S2.然后,我编辑我的手臂模板以添加存储帐户"资源.当我将更新的模板发布到现有资源组(其中Sql数据库扩展到S2的资源组)中以添加存储帐户时,我看到我的数据库缩减到了S1(arm模板中的默认值).

For example in my arm template Sql Database is initially provisioned for S1 performance and then scaled up to S2 by user. Then I edit my arm template to add Storage account resource for example. When I publish the updated template in to the existing resource group (the one with Sql database scaled up to S2) in order to add Storage account I see that my database is scaled down to S1 (the default value in my arm template).

我的问题是:有没有办法防止手臂模板修改现有资源的属性?

My question is: is there a way to prevent arm template from modifying properties of existing resources?

推荐答案

Azure RM模板的本质是作为声明性结构,用于定义解决方案的部署方式.如果发现模板中没有的内容,则应根据其性质将其更改为与模板匹配.

The nature of Azure RM Templates is to be a declarative structure that defines how a solution should be deployed. If it finds something that isn't in the template it should, by the nature of what it does, change it to match the template.

您最好将模板转换为Powershell脚本(或REST API调用),这样可以在创建/修改详细信息之前检查状态.

You might be better converting your templates to Powershell scripts (or REST API calls) that way you can check the state prior to creating / amending details.

另一种选择是在调用模板之前在脚本中修改这些参数.这样就可以将SQL数据库调整为S2(如果已经存在).

The other alternative would be to modify those parameters in a script before the template is called. So that you adjust the SQL Database to an S2 if that is what exists already.

这篇关于Azure-不允许Arm模板修改现有资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆