0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure function appをazure devops pipelineでデプロイする with terraform

Posted at

個人用です。

概要

えーマジazure devops!?azure devopsは小学生までだよねー!キャハハ

小学生と言わず一生無関係でいたかった。

条件

以下のterraformでfunction appを作成した

// https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_function_app
provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "linuxfunctionappsa"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Linux"
  sku_name            = "Y1"
}

resource "azurerm_linux_function_app" "example" {
  name                = "example-linux-function-app"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  storage_account_name = azurerm_storage_account.example.name
  service_plan_id      = azurerm_service_plan.example.id

  site_config {}
}

これに対して、azure devops pipelineからfunction appをデプロイすると以下のようなエラーが発生した

2022-06-23T13:33:49.1568910Z ##[error]Error: Unable to find the storage account associated with the function app.

ちなみにデプロイ方法は

steps:
- task: AzureFunctionApp@1
  displayName: 'Azure Function App Deploy'
  inputs:
    azureSubscription: 'xxxxx'
    appType: functionAppLinux
    appName: 'func-xxxxxx'
    package: 'xxxxxx'

これ

原因

storage_account_access_keyを設定したら解消出来ました。
手動だと設定しなくてもdeploy出来たんだけどなぁ。。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?