简体   繁体   English

使用 Z1B1ED905D54C18E3DD88289 部署 Azure powershell function 应用程序时出现问题

[英]Issue in deploying Azure powershell function app with terraform

I am facing the below error with azure function app blob trigger deployed with terraform我在使用 terraform 部署的 azure function 应用程序 blob 触发器时遇到以下错误

D:\a\1\s\src\RequestProcessor.cs:line 196 2021-01-08T14:24:46.222 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=973f1e27-3dc2-43d3-9463-7cac64bf56b7, Duration=6625ms)Result: FailureException: Failed to install function app dependencies. D:\a\1\s\src\RequestProcessor.cs:line 196 2021-01-08T14:24:46.222 [错误] 执行“Functions.BlobTrigger1”(失败,Id=973f1e27-3dc2-43d3-9463-7cac64bf56b7, Duration=6625ms)Result: FailureException: 未能安装 function 应用程序依赖项。 Error: 'No 'requirements.psd1' is found at the function app root folder: C:\home\site\wwwroot.错误:在 function 应用程序根文件夹中找到“No 'requirements.psd1':C:\home\site\wwwroot。

I have used this https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app for creating terraform code, by using the above document and other reference in google, i have written the below code in main.tf I have used this https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app for creating terraform code, by using the above document and other reference in google, i have written the below code in主文件

app_settings = {
        FUNCTIONS_WORKER_RUNTIME = var.FUNCTIONS_WORKER_RUNTIME
        FUNCTIONS_WORKER_RUNTIME_VERSION = var.FUNCTIONS_WORKER_RUNTIME_VERSION

Assigned the variable in variable.tf as below在 variable.tf 中分配变量如下

variable "FUNCTIONS_WORKER_RUNTIME"{
    default = "PowerShell" 
}

variable "FUNCTIONS_WORKER_RUNTIME_VERSION" {
    default = "~7"
}

But still could not able to see PowerShell Core Version in the app.但仍然无法在应用程序中看到 PowerShell 核心版本。

After my validation, you could set the value of FUNCTIONS_WORKER_RUNTIME to "powershell" instead of "PowerShell" and add the version = "~3" .经过我的验证,您可以将FUNCTIONS_WORKER_RUNTIME的值设置为"powershell"而不是"PowerShell"并添加version = "~3" It will automatically install the function app dependencies requirements.psd1 .它将自动安装 function 应用程序依赖项requirements.psd1

resource "azurerm_function_app" "example" {
  name                       = "urewwwwfunctiona"
  location                   = azurerm_resource_group.example.location
  resource_group_name        = azurerm_resource_group.example.name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key

  app_settings = {
        FUNCTIONS_WORKER_RUNTIME = "powershell"
        FUNCTIONS_WORKER_RUNTIME_VERSION = "~7"
       
  }

  version = "~3"

}

在此处输入图像描述

在此处输入图像描述

Hi I was able to deploy a Powershell Function App in Azure with azurerm_function_app, but Powershell Core Version is blank. Hi I was able to deploy a Powershell Function App in Azure with azurerm_function_app, but Powershell Core Version is blank.

I followed Nancy Xiong suggestion, but with no success:我遵循 Nancy Xiong 的建议,但没有成功:

resource "azurerm_function_app" "example" {
  name                       = "functionapptest"
  location                   = azurerm_resource_group.example.location
  resource_group_name        = azurerm_resource_group.example.name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  version = "~3"
  app_settings = {
        FUNCTIONS_WORKER_RUNTIME = "powershell"
        FUNCTIONS_WORKER_RUNTIME_VERSION = "~7"
       
  }
}

I was able to set the Python version for a Linux Function App using linux_fx_version, but I want to do the same for Powershell: I was able to set the Python version for a Linux Function App using linux_fx_version, but I want to do the same for Powershell:

site_config {
    linux_fx_version = "PYTHON|3.9"
}

The Terraform documentation is not clear about Powershell Function Apps. Terraform 文档不清楚 Powershell Function 应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM