获取功能Powershell中Azure功能的主机密钥 [英] Get Function & Host Keys of Azure Function In Powershell

查看:56
本文介绍了获取功能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天全站免登陆