question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AzureRmProvider.FunctionApp with UserManagedIdentity

See original GitHub issue

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 other comments that do not add relevant new information or questions, 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

I followed the guide for https://docs.microsoft.com/en-us/azure/azure-functions/functions-identity-based-connections-tutorial. The goal of this article, imho, is to provision an azure function to use ManagedIdentites to access both its keyvault and its storageaccount so that no secret values are stored in the FunctionApp configuration where anyone with access to the FunctionApp can see them.

The problem: cdktf is still forces me to provide a StorageAccountAccessKey in order to provision the FunctionApp whereby an AppSetting is autogenerated for AzureWebJobsStorage whose value is DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=fake;EndpointSuffix=core.windows.net. This is an issue, I believe, because the guide already had me set an AppSetting for AzureWebJobsStorage__accountName whose value is STORAGE_ACCOUNT_NAME and it’s therefore unclear to me which will be chosen.

When trying to deploy the FunctionApp without that StorageAccountAccessKey I get the following error:

[2022-06-15T13:31:57.909] [ERROR] default - ╷
│ Error: storage_account_access_key must not be empty, got
│
│   with azurerm_function_app.Poc_FunctionApp_FDAE6E57,
│   on cdk.tf.json line 63, in resource.azurerm_function_app.CdktfPoc_FunctionApp_FDAE6E57:
│   63:         "storage_account_access_key": "",

I apologize if there’s a beta package that supports this somewhere but I didn’t find it after a quick search, nor did I find documentation detailing how to use Managed Identities for this.

References

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielMSchmidtcommented, Jun 16, 2022

I just updated the Azurerm provider base version, it should now be present in azurerm 0.8.0

1reaction
DanielMSchmidtcommented, Jun 16, 2022

Looking at the provider documentation it seems like our bindings are correct (they state storage_account_access_key as required: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app#storage_account_access_key). It seems like this resource and the provider itself have gone out of sync, this probably won’t be fixed as this resource is already deprecated, so I would second @jsteinich here in that you should use the LinuxFunctionApp or WindowsFunctionApp 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Provider: Authenticating via Managed Identity | Guides
Managed identities for Azure resources can be used to authenticate to services that support Azure Active Directory (Azure AD) authentication. There are two ......
Read more >
Support for azurerm_function_app using Managed Identity ...
With the new public preview of Function Apps, it is now possible for the App to use a Managed Identity to access its...
Read more >
Managed identities - Azure App Service - Microsoft Learn
A managed identity from Azure Active Directory (Azure AD) allows your app to easily access other Azure AD-protected resources such as Azure Key ......
Read more >
Azure Functions with Managed identity in Terraform
You can run a Function App with Managed Identity for assigning Azure and API permissions. Managed Identities simplify authentication.
Read more >
dynamically add a user assigned managed identity to a ...
Is there a way to dynamically add a user assigned managed identity to a function app during Azure Devops Deployment?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found