The listkeys interface provides also a key used by the Event Grid trigger. The key should be provided via azurerm_function_app_host_keys, too.
$ az rest --method post --uri https://management.azure.com/subscriptions/.../providers/Microsoft.Web/sites/<concrete-app>s/host/default/listkeys?api-version=2018-02-01
{
"functionKeys": {
"default": "0Z3TqOwSm0OKWdhCUCS7O9sol564KwJHBbmHlYyizI7oruHoQ460HQ=="
},
"masterKey": "3xrDBj7IpXw9W28ntzL05fQrb2xeLFdwLbPgWF2cWoRW6VHf2Bvsow==",
"systemKeys": {
"eventgrid_extension": "1VIwUHay0Iirh4XfZikOB8RFaZqFccUuc0O9ilHi5bUgUb8D9sp2Xg=="
}
}
data "azurerm_function_app_host_keys" "example" {
name = "example-function"
resource_group_name = azurerm_resource_group.example.name
}
output "event_grid_key" {
// new attribute 'system_keys_eventgrid_extension'
value = azurerm_function_app_host_keys.example.system_keys_eventgrid_extension
}
Hi @sschmeck
Thanks for opening the issue, it was my fault, I didn't know when the system keys are being set (my use case was API management <=> function app ) and thus I didn't add them to the azurerm_function_app_host_keys ...
I can take this and fix it,
Are you aware of any other usage of system_keys and when they are being set ?
Hi @3mard , thank you very much for your contribution of #7902. I'm that it is merged now.
Personally I had only use cases for function keys as you provided and the mentioned system key for Event Grid Triggers.
I can take care of this on the weekend 馃殌
Hi @3mard , I checked the _App Keys_ view in the Azure Portal. It seems, there is a conceptual distinction between _host keys_ and _system keys_. The difference isn't clear to me.

Since the new resource is called azurerm_function_app_host_keys, adding the system keys is misleading. What do you think?
I agree with you @sschmeck , the resource name is a bit misleading .. sorry for that not sure if it's a big deal if we export system keys from azurerm_function_app_host_keys or should we create a new resource perhaps azurerm_function_app_system_keys
What do @magodo and @tombuildsstuff think about this ?
@3mard Personally, I think current name of this data source is consistent to the Azure API used under the scenes (i.e. client.ListHostKeys). For the same reason, as the SystemKeys is one of the attributes of the returned model of that API, it makes sense to export that attribute just in this data source. In my experience, we prefer conforming to the Azure API over the Portal visualization.
Speaking of the interface for this specific system key, i would suggest to introduce a specific field for it, as suggested by Tom.
@magodo I need this is why I went with name azurerm_function_app_host_keys because the function is called client.ListHostKeys
I will do what @magodo suggested
@3mard I see the original version of this data source supported ALL the function keys not just master and default. While making this change would it be possible to re-add the rest of the keys as well? We have a case where we are creating a custom key but we can't retrieve it currently.