az deployment group create --resource-group rg-py-func-tst --template-file main.bicep
// Created by Microsoft Copilot and Google Gemini
// This Bicep script deploys an EMPTY Python 3.11 Function App named
// 'shawnopyFuncTest' without App Insights, at service level Y1.
// It creates a storage account named 'pyfunctest100', an app service
// plan named 'pyfunctestAppService', and the function app itself.
//
// I do not have the Python code yet. The Python code will be
// deployed in a separate project. I just want to create an
// empty Python Function App
@description('Name of the storage account')
param storageAccountName string = 'pyfunctest100'
@description('Name of the app service plan')
param appServicePlanName string = 'pyfunctestAppService'
@description('Name of the function app')
param functionAppName string = 'shawnopyFuncTest'
@description('Location for all resources')
param location string = resourceGroup().location
// Define the storage account resource
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}
// Define the app service plan resource
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: appServicePlanName
location: location
kind: 'linux'
sku: {
name: 'Y1'
tier: 'Dynamic'
}
properties:{
reserved: true
}
}
// Define the function app resource (Updated API version)
resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
name: functionAppName
location: location
kind: 'functionapp,linux'
properties: {
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'Python|3.11'
appSettings: [
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'python'
}
{
name: 'AzureWebJobsStorage'
value: storageAccount.properties.primaryEndpoints.blob
}
]
}
}
}
output storageAccountName string = storageAccount.name
output appServicePlanName string = appServicePlan.name
output functionAppName string = functionApp.name
我已经在两个完全独立的Azure租户中运行了上述部署,结果始终是相同的。我的资源组RG-PY-FUNC-TST填充了:一个名为Pyfunctest100的存储帐户;一个名为PyfunctappService的应用程序服务计划;并且,一个名为ShawnopyFunctest的功能应用程序。那就是我想要的;不幸的是,这不是故事的结尾。
当我打开新部署的空功能应用程序shawnopyfunctest时,我在运行时版本字段中看到文本“错误”:有人可以帮助我纠正Copilot女士和双子座创建的二头肌吗?如果没有,您能否提供一个更简单,更干净的模板,仍然可以执行我的需求?
aCorcording to thedocs
FUNCTIONS_EXTENSION_VERSION
// Created by Microsoft Copilot and Google Gemini
// This Bicep script deploys an EMPTY Python 3.11 Function App named
// 'shawnopyFuncTest' without App Insights, at service level Y1.
// It creates a storage account named 'pyfunctest100', an app service
// plan named 'pyfunctestAppService', and the function app itself.
//
// I do not have the Python code yet. The Python code will be
// deployed in a separate project. I just want to create an
// empty Python Function App
@description('Name of the storage account')
param storageAccountName string = 'pyfunctest100'
@description('Name of the app service plan')
param appServicePlanName string = 'pyfunctestAppService'
@description('Name of the function app')
param functionAppName string = 'shawnopyFuncTest'
@description('Location for all resources')
param location string = resourceGroup().location
// Define the storage account resource
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}
// Define the app service plan resource
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: appServicePlanName
location: location
kind: 'linux'
sku: {
name: 'Y1'
tier: 'Dynamic'
}
properties:{
reserved: true
}
}
// Define the function app resource (Updated API version)
resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
name: functionAppName
location: location
kind: 'functionapp,linux'
properties: {
serverFarmId: appServicePlan.id
siteConfig: {
linuxFxVersion: 'Python|3.11'
appSettings: [
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'python'
}
{
name: 'AzureWebJobsStorage'
value: storageAccount.properties.primaryEndpoints.blob
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4'
}
]
}
}
}
output storageAccountName string = storageAccount.name
output appServicePlanName string = appServicePlan.name
output functionAppName string = functionApp.name