如何在ARM模板中创建Azure功能键?

问题描述 投票:1回答:1

我整天都在为此苦苦挣扎,我正试图从ARM模板创建Function App功能键。

到目前为止,我已经可以使用以下模板在主机级别创建功能键:

    {
      "type": "Microsoft.Web/sites/host/functionKeys",
      "apiVersion": "2018-11-01",
      "name": "[concat(parameters('appServiceName'), '/default/PortalFunctionKey')]",
      "properties": {
        "name": "PortalFunctionKey"
      }

然后,我找到了几篇文章和链接,显示可以通过API进行操作:https://github.com/Azure/azure-functions-host/wiki/Key-management-API

而且我能够通过以下API生成它:https://{myfunctionapp}.azurewebsites.net/admin/functions/{MyFunctionName}/keys/{NewKeyName}?code={_masterKey}

但是为了我自己,我无法在我的ARM模板中弄清楚该怎么做!我尝试过各种类型和名称的组合,例如:

    {
      "type": "Microsoft.Web/sites/host/functionKeys",
      "apiVersion": "2018-11-01",
      "name": "[concat(parameters('appServiceName'), '/{myfunctionName}/PortalFunctionKey')]",
      "properties": {
        "name": "PortalFunctionKey"
      }

或/ functions / {myfunctionName} / PortalFunctionKey正如某些文章中所建议的,我只是无法工作,也无法在ARM Microsoft.Web / sites / host / functionKeys上找到太多文档。

[有人在ARM模板中成功创建了FUNCTION键(不是主机)吗?我很高兴听到你如何到达那里:)!

基本上:Function Keys

非常感谢,

伊曼纽尔

azure azure-functions arm-template
1个回答
0
投票

要解决此问题,您可以参考此github问题。 First issuesecond issue,这些问题都涉及如何在ARM模板中获取功能键的问题。

现在,获取键值的示例如下所示:

"properties": {
        "contentType": "text/plain",
        "value": "[listkeys(concat(variables('functionAppId'), '/host/default/'),'2016-08-01').functionKeys.default]"
        }

或在下面获得关键对象。

"functionkeys": {
            "type": "object",
            "value": "[listkeys(concat(variables('functionAppId'), '/host/default'), '2018-11-01')]"                                                                                }
    }

您可以尝试,希望能为您提供帮助。

© www.soinside.com 2019 - 2024. All rights reserved.