我正在嘗試獲取我當前站點/插槽應用程式配置的串列,然后將其與聯合體結合起來,這樣我就不會覆寫當前部署的配置。我可以使用站點配置執行此操作,但不能使用部署插槽。
這是我在main.bicep中的作業網站示例
resource sites_web_name 'Microsoft.Web/sites@2021-02-01' = {
parameters here(irrelevant for excercise)
}
module web_appsettings_config './appsettings.bicep' = {
name: 'webAppSettings'
params: {
//this gets a list of the current app settings for the web site resource
currentAppSettings: list('${sites_web_name.id}/config/appsettings', '2021-02-01').properties
appSettings: {
'Config1': 'confighere'
'Config2': 'config2here'
'Config3': 'config3here'
}
name: '${sites_web_name.name}/appsettings'
}
}
appsettings.二頭肌
param currentAppSettings object
param appSettings object
param name string
resource siteConfig 'Microsoft.Web/sites/config@2021-02-01' = {
name: name
properties: union(currentAppSettings, appSettings)
}
以上是采用當前部署的應用程式設定,如果模板中未指定新設定,則不會洗掉/覆寫它們。
現在嘗試獲取站點/插槽的問題
主二頭肌
resource sites_web_slots_name 'Microsoft.Web/sites/slots@2021-02-01' = {
parameters here(irrelevant for excercise)
}
module web_staging_appsettings_config './slotappsettings.bicep' = {
name: 'webStagingAppSettings'
params: {
//this gets a list of the current app settings for the web slot resource
currentAppSettings: list('${sites_web_slots_name.id}/slots/config/appsettings', '2021-02-01').properties
appSettings: {
'Config1': 'confighere'
'Config2': 'config2here'
'Config3': 'config3here'
}
name: '${sites_web_slots_name.name}/appsettings'
}
}
甚至做了一個單獨的模塊,slotappsettings.bicep
param currentAppSettings object
param appSettings object
param name string
resource siteSlotConfig 'Microsoft.Web/sites/slots/config@2021-02-01' = {
name: name
properties: union(currentAppSettings, appSettings)
}
我因插槽故障而得到的錯誤根本沒有幫助:
ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"NotFound","message":"{\r\n "error": {\r\n "code": "InvalidResourceNamespace",\r\n "message": "The resource namespace 'subscriptions' is invalid."\r\n }\r\n}"}]}}
I also don't get any deployment failure messages in the azure portal. Here is the documentation for the api versions I'm using:
sites/config/appsettings:
sites/config-appsettings
resource symbolicname 'Microsoft.Web/sites/config@2021-02-01' = {
name: 'appsettings'
kind: 'string'
parent: resourceSymbolicName
properties: {}
}
sites/slots/config/appsettings:
sites/slots/config-appsettings
resource symbolicname 'Microsoft.Web/sites/slots/config@2021-02-01' = {
name: 'appsettings'
kind: 'string'
parent: resourceSymbolicName
properties: {}
}
uj5u.com熱心網友回復:
There is a typo while calling the list function for the slot settings:
You have /slots/config/appsettings but it should only be /config/appsettings because the /slots segment is already included in the resource id of the slot (sites_web_slots_name.id)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/437225.html
標籤:azure azure-resource-manager azure-deployment azure-bicep
上一篇:Terraform-操作區域變數
