eri*_*npc 5 azure-web-app-service azure-bicep
我正在尝试使用 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'
}
Run Code Online (Sandbox Code Playgroud)
这是我第一次尝试使用“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'
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我第二次尝试使用“Microsoft.Web/sites/config”设置堆栈,如下所示:
Bicep - 如何将运行时堆栈配置到 Azure 应用服务(Bicep 版本 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'
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
结果是一样的。部署完成,但出现以下警告:
警告 BCP037:“SiteConfig”类型的对象不允许使用“元数据”属性。允许的属性包括“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”、“限制”、“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-核心应用程序服务/)。然而,二头肌(Bicep)似乎还不支持这一点。如果有人找到了可行的解决方案,请将其发布在这里。谢谢。
元数据参数在SiteConfig. 可以提到堆栈设置LinuxFxVersion。
因此,解决方案将是而不是使用dotnet|3.1,您应该使用DOTNETCORE|3.1。所有代码如下:
resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
name: 'MyAppService'
location: resourceGroup().location
properties: {
reserved: true
}
sku: {
name: 'P1v2'
}
kind: 'linux'
}
resource appService 'Microsoft.Web/sites@2021-02-01' = {
name: 'anumantestapp'
location: resourceGroup().location
identity: {
type: 'SystemAssigned'
}
kind: 'app'
properties: {
enabled: true
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'DOTNETCORE|3.1'
appCommandLine: 'dotnet MyApp.dll'
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
| 归档时间: |
|
| 查看次数: |
3849 次 |
| 最近记录: |