# Function app App Keys not getting generated

**URL:** <https://discuss.hashicorp.com/t/function-app-app-keys-not-getting-generated/60138>\
**Category:** Azure\
**Created:** [November 17, 2023, 1:28pm UTC](https://discuss.hashicorp.com/t/function-app-app-keys-not-getting-generated/60138 "2023-11-17T13:28:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lijink14](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@lijink14](https://discuss.hashicorp.com/u/lijink14)\
**Post date:** [November 17, 2023, 1:28pm UTC](https://discuss.hashicorp.com/t/function-app-app-keys-not-getting-generated/60138/1 "2023-11-17T13:28:39Z")

</div>

Hello Team,

I am trying to create a function app via terraform using the template i have provided below in the git link. Function app is getting created but the app keys are not loading/generated. The function app is not available for deploying functions to it resulting in

Error: Encountered an error (ServiceUnavailable) from host runtime.

template : [GitHub - lijink14/terraform\_functionapp: Terraform for creating function app in azure cloud](https://github.com/lijink14/terraform_functionapp)

 ![Screenshot 2023-11-17 at 6.33.04 PM](https://global.discourse-cdn.com/hashicorp/original/3X/8/e/8ec92e6056acdf949ed039d381842f2bc0ca7f8e.png)

It would be awesome if someone can help me identify the issue here and resolve it, been stuck here for some time.

Thanks in advance.

regards  
Lijin

---

<div class="post-metadata">

**Author:** ![bouke](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/bouke/32/40552_2.png) [@bouke](https://discuss.hashicorp.com/u/bouke)\
**Post date:** [February 26, 2024, 8:09am UTC](https://discuss.hashicorp.com/t/function-app-app-keys-not-getting-generated/60138/2 "2024-02-26T08:09:20Z")

</div>

I ran into the same problem. In my case terraform apply was stuck on fetching the keys:

```auto
data.azurerm_function_app_host_keys.host_key: Still reading... [20m0s elapsed]

Service returned an error. Status=400 Code="BadRequest" Message="Encountered an error (ServiceUnavailable) from host runtime."

```

When debugging I found that the function app needs to be able to boot to show the host keys. I found it couldn’t start because there was no package uploaded even though `WEBSITE_RUN_FROM_PACKAGE=1` was set. Removing the configuration value made the website startup (with the generic “Your Functions 4.0 app is up and running”), and the host keys were displayed.
