Get Function & Host Keys of Azure Function In Powershell

前端 未结 4 741
孤街浪徒
孤街浪徒 2020-12-09 20:56

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 Fro

4条回答
  •  没有蜡笔的小新
    2020-12-09 21:21

    Question doesn't seem to be answered as it was requesting to get the Function key from Powershell and not ARM templates. I'm using the script below to get the function key from Powershell in Azure DevOps.

    $accountInfo = az account show
    $accountInfoObject = $accountInfo | ConvertFrom-Json
    $subscriptionId  = $accountInfoObject.id
    
    $resourceGroup = "your-resource-group"
    $functionName = "your-function-name"
    
    $functionkeylist = az rest --method post --uri "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Web/sites/$functionName/host/default/listKeys?api-version=2018-11-01"
    $keylistobject = $functionkeylist | ConvertFrom-Json
    $functionKey = $keylistobject.functionKeys.default
    

    Hope this helps.

提交回复
热议问题