如何列出 Azure Function App 中的所有函数 [英] How to list all the functions in an Azure Function App

查看:11
本文介绍了如何列出 Azure Function App 中的所有函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用 PowerShell cmdlet Get-AzureRMResource 列出所有 Azure 资源.

I can use the PowerShell cmdlet Get-AzureRMResource to list all Azure resources.

是否有一个 cmdlet 需要一个 ResourceGroupName 和一个 SiteName 并返回该站点"中的所有函数.

Is there a cmdlet that takes a ResourceGroupName and a SiteName and it returns all the functions in that "Site".

或者,我可以用来获取这些详细信息的 cmdlet 组合.

Or, a combination of cmdlets that I can use to get these details.

推荐答案

正如 Fabio Cavalcante 所说,Azure PowerShell 不支持这个,你可以使用 Rest API 来获取它.这是一个如何使用 PowerShell 获取函数的示例.

As Fabio Cavalcante said, Azure PowerShell does not support this, you could use Rest API to get it. Here is a example how to get Functions with PowerShell.

#

#get token
$TENANTID="<tenantid>"
$APPID="<application id>"
$PASSWORD="<app password>"
$result=Invoke-RestMethod -Uri https://login.microsoftonline.com/$TENANTID/oauth2/token?api-version=1.0 -Method Post -Body @{"grant_type" = "client_credentials"; "resource" = "https://management.core.windows.net/"; "client_id" = "$APPID"; "client_secret" = "$PASSWORD" }
$token=$result.access_token

##set Header
$Headers=@{
    'authorization'="Bearer $token"
    'host'="management.azure.com"
}

$functions = Invoke-RestMethod  -Uri "https://management.azure.com/subscriptions/<subscriptions id>/resourceGroups/<group name>/providers/Microsoft.Web/sites/<function name>/functions?api-version=2015-08-01"  -Headers $Headers -ContentType "application/json" -Method GET

$functions.value

这篇关于如何列出 Azure Function App 中的所有函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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