获取函数Powershell中Azure函数的主机键 [英] Get Function & Host Keys of Azure Function In Powershell

查看:23
本文介绍了获取函数Powershell中Azure函数的主机键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Arm 模板部署了 Azure 函数.我需要功能键 &在 Powershell 中部署的 Azure 函数的主机密钥.目前我正在尝试从 ARM 模板的输出部分获取密钥

I have deployed Azure function using Arm template. I need the Function Key & host Key of deployed Azure Function in Powershell. Currently I am trying to get the keys From Output Section of ARM template

 "outputs": {
"FunctionAppName": {
  "type": "string",
  "value": "[variables('functionAppName')]"
},
"Key": {
  "type": "string",
  "value": "[listKeys(resourceId('Microsoft.Web/sites', '[variables('functionAppName')]'),'2015-08-01').keys]"
}

}

我尝试了不同的组合但失败了.有没有办法在Powershell中检索密钥?

I tried different combinations But it failing. Is there any way to retrieve keys in Powershell?

推荐答案

我使用以下方法使其工作:

I got it working by using the following:

    "outputs": {
    "FunctionAppName": {
        "type": "string",
        "value": "[parameters('functionName')]"
    },
    "Key": {
        "type": "string",
        "value": "[listsecrets(resourceId('Microsoft.Web/sites/functions', parameters('existingFunctionAppName'), parameters('functionName')),'2015-08-01').key]"
    },        
    "Url": {
        "type": "string",
        "value": "[listsecrets(resourceId('Microsoft.Web/sites/functions', parameters('existingFunctionAppName'), parameters('functionName')),'2015-08-01').trigger_url]"
    }        
}

我也找不到任何示例.但是通过使用上述内容,GitHub资源功能 以及一些试验和错误,我明白了.

I couldn't find any examples either. But by using the above, a quickstart sample at GitHub and the documentation of resource functions along with a some trial and error, I got it to out.

请注意变量/参数和名称已更改.

Please note the variables/parameters and names have been changed.

这篇关于获取函数Powershell中Azure函数的主机键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆