title: Get Azure Function keys from an Azure Function at deployment time?
body: <p>I'm sending an email in Azure Functions using the <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-sendgrid" rel="nofollow noreferrer">SendGrid bindings</a>. As part of the contents of that email, I'd like to include a link to one of the <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook" rel="nofollow noreferrer">HTTP methods</a> in the Azure Functions instance for more information. I have all my HTTP functions secured with <code>AuthorizationLevel.Function</code>.</p>
  
  <p>I've seen a solution for <a href="https://stackoverflow.com/a/50264228/4062072">scraping the keys from ARM and Kudu in PowerShell</a> (and <a href="https://stackoverflow.com/a/46436102/4062072">this one</a>) and a solution to <a href="https://stackoverflow.com/a/44117841/4062072">output the keys with just ARM</a>, but these both rely on having something my Azure Functions do not: permissions to the ARM (Azure Resource Management) APIs.</p>
  
  <p>I also found the <a href="https://github.com/Azure/azure-functions-host/wiki/Key-management-API" rel="nofollow noreferrer">Key management APIs for the Azure Functions host</a> which works exactly as I want locally, but I don't know how to get past the <code>401 Unauthorized</code> once the Azure Functions are deployed. I can get past it manually with the <code>_master</code> function key, but then I'm back to not knowing how to get that key at runtime.</p>
  
  <p>The question is this: Is it possible to get the key for an Azure Function at runtime from the Azure Function Host somehow? I would very much prefer to not need ARM permissions to do that.</p>