在Bicep模板中添加以下代码段以自动设置默认文档:
resource appServiceConfig 'Microsoft.Web/sites/config@2021-02-01' = {
name: '${webAppName}/web'
properties: {
defaultDocuments: [
'index.html',
'default.html'
]
}
}
resource webApp 'Microsoft.Web/sites@2021-02-01' = {
name: webAppName
location: location
kind: 'app'
properties: {
siteConfig: appServiceConfig.properties
}
}
其中defaultDocuments
属性设置了默认文档列表,如果需要更改默认文档,可以更新列表中的项目。此外,可以将此代码段添加到现有的Bicep文件中,或者将其保存为独立的Bicep文件以便于将其添加到项目中。