How to list all the functions in an Azure Function App

前端 未结 3 2045
陌清茗
陌清茗 2021-01-18 20:27

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

Is there a cmdlet that takes a ResourceGroupName and a

相关标签:
3条回答
  • 2021-01-18 20:41

    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
    

    0 讨论(0)
  • 2021-01-18 20:46

    This is possible using the Get-AzureRmResource cmdlet.

    $Params = @{
        ResourceGroupName = $ResourceGroupName
        ResourceType      = 'Microsoft.Web/sites/functions'
        ResourceName      = $AppName
        ApiVersion        = '2015-08-01'
    }
    Get-AzureRmResource @Params
    
    0 讨论(0)
  • 2021-01-18 20:54

    Not a PowerShell cmdlet, but you can use the ListFunctions API as described here

    0 讨论(0)
提交回复
热议问题