Wednesday, September 22, 2021

Get Function Token CLI

 Notice the name of the token which is created as App keys in the function.

function GetFunctionToken {

    param (

        [string[]]$funcResGroupName,
        [string[]]$funcName

    )

          

    # Get function token
    $url = "/subscriptions/$subscriptionId/resourceGroups/$funcResGroupName/providers/Microsoft.Web/sites/$funcName/host/default/listKeys?api-version=2018-11-01"

    $functionCode = az rest --method post --uri $url --query functionKeys.appkeyName --output tsv
    return $functionCode

}