gpt4 book ai didi

Azure Bicep - 如果使用相同模板进行部署时显示资源更改的命令会怎样

转载 作者:行者123 更新时间:2023-12-02 06:54:38 25 4
gpt4 key购买 nike

我刚开始使用 Azure 二头肌。我正在尝试使用以下二头肌文件部署一个简单的应用程序服务计划/应用程序服务:

resource azBicepAsp1 'Microsoft.Web/serverfarms@2020-12-01' = {
name: 'test-dev-aue-asp1'
location: resourceGroup().location
kind: ''
sku: {
name: 'F1'
capacity: 1
}
}

resource azbicepas 'Microsoft.Web/sites@2021-01-15' = {
name: 'test-dev-aue-wapp1'
location: resourceGroup().location
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', 'test-dev-aue-asp1')
}
dependsOn:[
azBicepAsp1
]
}

使用:

az 部署组 create -g azbbicepad-dev-au-rg1 -f 2.AppServicePlan.bicep --confirm-with-what-if

它部署成功,但是如果我使用完全相同的部署再次部署它,它会表示将进行以下更改:

  - Delete
+ Create
~ Modify

The deployment will update the following scope:

Scope: /subscriptions/71913b63-cacf-41bf-9da1-e3a1db24e62c/resourceGroups/azbbicepad-dev-au-rg1

~ Microsoft.Web/serverfarms/test-dev-aue-asp1 [2020-12-01]
- kind: "app"
~ sku.capacity: 0 => 1

~ Microsoft.Web/sites/test-dev-aue-wapp1 [2021-01-15]
+ properties.siteConfig.localMySqlEnabled: false
+ properties.siteConfig.netFrameworkVersion: "v4.6"

我不太明白为什么会发生这种情况 - 有人可以指出我正确的方向吗?

谢谢

最佳答案

关于应用服务计划:

  • 如果您指定免费层级,则容量始终为0。首次部署模板时,指定的容量将被忽略并设置为 0。重新部署时,模板中定义的内容与目标资源不匹配。
  • 如果不指定种类,则默认为 app。同样,模板与目标资源不匹配。

对此有一个很好的解释 post .:

Noise

One issue you may see when using this command is noise, where the results show that a resource is being changed when no change will occur. This is usually down to the fact that the information you provide to the ARM API to create or update a resource is less than the data returned when querying it, or that defaults are being used. An example seen early in the preview was when deploying a storage account, if you did not specify the encryption settings in the template (so using the defaults), then What-If showed a change because it thought it was removing these settings.

This is something the ARM team is aware of and are working to remove during the preview. They are asking for everyone using this command to keep an eye out for these issues and log them in this Github issues log. Please do log issues when you see them to help improve this command and get it out of preview as soon as possible.

关于Azure Bicep - 如果使用相同模板进行部署时显示资源更改的命令会怎样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73685615/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com