【发布时间】:2021-11-09 11:53:04
【问题描述】:
我正在尝试使用 Azure CLI 中的 Bicep 模板在 Linux 上部署 .NET Core 3.1 Azure 应用服务。应用服务和相应的应用服务计划已正确部署,但 Azure 门户上的应用服务堆栈设置为空,我必须手动设置这些设置。我尝试在“Microsoft.Web/sites”资源和“Microsoft.Web/sites/config”资源上设置元数据属性,但结果是一样的。
这是我的应用服务计划:
resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
name: 'MyAppService'
location: resourceGroup().location
properties: {
reserved: true
}
sku: {
name: 'P1v2'
}
kind: 'linux'
}
这是我第一次尝试使用此处建议的“Microsoft.Web/sites”设置堆栈:
https://github.com/Azure/bicep/issues/3314
resource appService 'Microsoft.Web/sites@2021-02-01' = {
name: 'MyApp'
location: resourceGroup().location
identity: {
type: 'SystemAssigned'
}
kind: 'app'
properties: {
enabled: true
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'dotnet|3.1'
appCommandLine: 'dotnet MyApp.dll'
metadata: [
{
name: 'CURRENT_STACK'
value: 'dotnetcore'
}
]
}
}
}
这是我第二次尝试使用此处建议的“Microsoft.Web/sites/config”设置堆栈:
Bicep - How to config Runtime Stack to Azure App Service (Bicep version 0.4)
resource appService 'Microsoft.Web/sites@2021-02-01' = {
name: 'MyApp'
location: resourceGroup().location
identity: {
type: 'SystemAssigned'
}
kind: 'app'
properties: {
enabled: true
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'dotnet|3.1'
appCommandLine: 'dotnet MyApp.dll'
}
}
resource webConfig 'config' = {
name: 'web'
properties: {
metadata: [
{
name: 'CURRENT_STACK'
value: 'dotnetcore'
}
]
}
}
}
结果是一样的。部署完成并出现以下警告:
警告 BCP037:属性“元数据”不允许用于 键入“站点配置”。允许的属性包括 “acrUseManagedIdentityCreds”、“acrUserManagedIdentityID”、“alwaysOn”、 “apiDefinition”、“apiManagementConfig”、“autoHealEnabled”、 “autoHealRules”、“autoSwapSlotName”、“azureStorageAccounts”、 “connectionStrings”、“cors”、“defaultDocuments”、 “detailedErrorLoggingEnabled”、“documentRoot”、“实验”、 "ftpsState", "functionAppScaleLimit", "functionsRuntimeScaleMonitoringEnabled", "handlerMappings", “healthCheckPath”、“http20Enabled”、“httpLoggingEnabled”、 “ipSecurityRestrictions”、“javaContainer”、“javaContainerVersion”、 “javaVersion”、“keyVaultReferenceIdentity”、“limits”、“loadBalancing”、 “localMySqlEnabled”、“logsDirectorySizeLimit”、“managedPipelineMode”、 "managedServiceIdentityId", "minimumElasticInstanceCount", “minTlsVersion”、“netFrameworkVersion”、“nodeVersion”、 “numberOfWorkers”、“phpVersion”、“powerShellVersion”、 “preWarmedInstanceCount”、“publicNetworkAccess”、“publishingUsername”、 "push", "pythonVersion", "remoteDebuggingEnabled", "remoteDebuggingVersion", "requestTracingEnabled", "requestTracingExpirationTime", "scmIpSecurityRestrictions", “scmIpSecurityRestrictionsUseMain”、“scmMinTlsVersion”、“scmType”、 “tracingOptions”、“use32BitWorkerProcess”、“virtualApplications”、 “vnetName”、“vnetPrivatePortsCount”、“vnetRouteAllEnabled”、 “websiteTimeZone”、“webSocketsEnabled”、“windowsFxVersion”、 “xManagedServiceIdentityId”。如果这是一个不准确的 文档,请向二头肌团队报告。 [https://aka.ms/bicep-type-issues]
资源已部署,但应用服务堆栈设置为空白,我必须手动设置才能使其工作。
我知道在 ARM 模板中,这是在 Microsoft.Web/sites/config 元数据的 CURRENT_STACK 属性上设置的(如此处建议的https://cloudstep.io/2020/11/18/undocumented-arm-oddities-net-core-app-services/)。但是,二头肌似乎(尚)不支持此功能。如果有人找到了可行的解决方案,请在此处发布。 谢谢。
【问题讨论】:
-
您好@erionpc,您可以在Microsoft 文档中的siteconfig 下看到,不再有元数据参数。
-
@AnsumanBal-MT 但它仍然有效,并且是目前为 Windows 应用计划声明 dotnet 核心堆栈的唯一方法
标签: azure-web-app-service azure-bicep