Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for acr_use_managed_identity_credentials in azurerm_function_app #15905

Closed
mickare opened this issue Mar 21, 2022 · 6 comments
Closed
Labels
service/functions Function Apps

Comments

@mickare
Copy link

mickare commented Mar 21, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The resource for Azure Function App azurerm_function_app is missing the acr_use_managed_identity_credentials property in site_config.

It was already added for the azurerm_app_service resource in the PR #12745 .

New or Affected Resource(s)

  • azurerm_function_app

Potential Terraform Configuration

resource "azurerm_resource_group" "example" {
  name     = "azure-functions-cptest-rg"
  location = "West Europe"
}

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

resource "azurerm_container_registry" "example" {
  name                = "crcrmyregistry"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  sku                 = "Premium"
  admin_enabled       = true
}

resource "azurerm_app_service_plan" "example" {
  name                = "azure-functions-test-service-plan"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  kind                = "Linux"
  reserved            = true

  sku {
    tier     = "Standard"
    size     = "S1"
    capacity = 1
  }
}

resource "azurerm_function_app" "example" {
  name                       = "test-azure-functions"
  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
  os_type                    = "linux"
  version                    = "~3"


  identity {
    type = "SystemAssigned"
  }
  site_config {
    linux_fx_version                     = "DOCKER|${azurerm_container_registry.example.login_server}/image:tag"
    acr_use_managed_identity_credentials = true 
  }
  app_settings = {
    "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = false
  }
}


resource "azurerm_role_assignment" "example" {
  count                = length(azurerm_function_app.example.identity)
  scope                = azurerm_container_registry.example.id
  role_definition_name = "AcrPull"
  principal_id         = azurerm_function_app.example.identity[count.index].principal_id
}

References

@mickare
Copy link
Author

mickare commented Mar 21, 2022

It is possible to update the function app by hand:

az functionapp update \
    --name "test-azure-functions" \
    --resource-group "azure-functions-cptest-rg" \
    --set "siteConfig.acrUseManagedIdentityCreds=true"

@mickare
Copy link
Author

mickare commented Mar 21, 2022

It seems that this will be solved in version 3? See #15884

@alessiofilippin

This comment was marked as duplicate.

@blueskyson

This comment was marked as duplicate.

@rcskosir rcskosir added the service/functions Function Apps label Jun 12, 2023
@rcskosir
Copy link
Contributor

rcskosir commented Oct 6, 2023

Thanks for opening this issue. The azurerm_function_app resource is deprecated in version 3. 0 and will be removed in version 4.0 - so I'd suggest moving to the azurerm_linux_function_app and azurerm_windows_function_app resources instead.
If this feature request has not been satisfied in 3.x version of the provider for azurerm_linux_function_app and azurerm_windows_function_app resources please do let us know by opening a new feature request, thanks!

@rcskosir rcskosir closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
Copy link

github-actions bot commented May 5, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/functions Function Apps
Projects
None yet
Development

No branches or pull requests

4 participants