我有一个 Bicep 模块来创建功能应用程序及其诊断设置,成功部署后,我看到门户上的“诊断设置”菜单呈灰色 - 请参阅链接图像,因为我仍然无法嵌入图像:-).
但是,作为部署的一部分,我还为 Function 应用程序创建了一个插槽(暂存),并且暂存实例启用了其“诊断设置”菜单,我可以查看和编辑这些设置 - 再次查看链接的图像。
有谁知道为什么会这样吗?这些应用程序服务实例没有部署任何内容,因此它们都是“空”
这是部署这些的代码:
resource app 'Microsoft.Web/sites@2020-12-01' = {
name: appName
location: location
tags: {
'hidden-link: /app-insights-resource-id': appInsightsId
Customer: customerName
Environment: environment
Project: projectName
}
kind: 'functionapp'
identity: {
type: 'SystemAssigned'
}
properties: {
serverFarmId: appServerFarmId
siteConfig: {
alwaysOn: false
http20Enabled: true
}
httpsOnly: true
}
}
resource diagSettingsApp 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
scope: app
name: 'diagsetting-${app.name}'
properties: {
workspaceId: lawId
logs: [
{
category: 'FunctionAppLogs'
enabled: true
}
]
metrics: [
{
category: 'AllMetrics'
enabled: true
}
]
}
}
resource appSlot 'Microsoft.Web/sites/slots@2020-12-01' = {
name: '${app.name}/staging'
location: location
tags: {
Customer: customerName
Environment: environment
Project: projectName
}
kind: 'functionapp'
properties: {
serverFarmId: appServerFarmId
siteConfig: {
http20Enabled: true
appSettings: [
{
name: 'WEBSITE_DNS_SERVER'
value: '168.63.129.16'
}
{
name: 'WEBSITE_VNET_ROUTE_ALL'
value: '1'
}
]
}
httpsOnly: true
}
}
resource diagSettingsAppSlot 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
scope: appSlot
name: 'diagsetting-${app.name}-staging'
properties: {
workspaceId: lawId
logs: [
{
category: 'FunctionAppLogs'
enabled: true
}
]
metrics: [
{
category: 'AllMetrics'
enabled: true
}
]
}
}
如果应用程序设置
Diagnostic settings
设置为 FUNCTIONS_EXTENSION_VERSION
而不是 ~1
,~4
可能会变灰。
如果是这种情况,您应该考虑将应用程序迁移到版本 4x: