【发布时间】:2019-11-04 14:41:27
【问题描述】:
我正在尝试使用 Powershell 和 Azure CLI 获取 azure function V2 密钥,下面是代码。我收到错误:
未找到({"error":{"code":"NotFound","message":"检索功能键时出错。"}})
如果不将 AzureWebJobsSecretStorageType 应用设置设置为“文件”,似乎无法获取 Azure Function V2 的密钥。
https://github.com/Azure/azure-functions-host/wiki/Changes-to-Key-Management-in-Functions-V2
我发现的唯一有用的文章是:
https://markheath.net/post/managing-azure-functions-keys-2
根据https://github.com/Azure/azure-functions-host/issues/3994 应该可以工作。
我错过了什么吗?
$webAppName = 'XXX'
$resourceGroup = 'YYY'
$subscriptionId = 'ZZZ'
$resourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Web/sites/$webAppName"
az rest --method post --uri "https://management.azure.com$resourceId/functions/$webAppName/listKeys?api-version=2018-02-01"
【问题讨论】:
-
你试过官方的rest api了吗。github.com/Azure/azure-functions-host/wiki/…
-
据我所知,在这种情况下我需要处理身份验证令牌,我想通过使用 az rest 来避免这种情况