我正在使用 powershell 并尝试访问 Azure 函数行政使用 API。
我正在尝试获取在 $appName 下创建的所有函数的列表
当然,我在调用之前将 $appName 更改为实际的 Azure 函数名称
在这次通话之前我也得到了有效的 $authToken 。
以下网址:
$Functions = Invoke-RestMethod -Method GET -Headers @{Authorization = ("Bearer {0}" -f $authToken)} -Uri "https://$appName.azurewebsites.net/admin/functions"
我的 powershell 执行中的错误是:
调用 RestMethod :
The underlying connection was closed: An unexpected error occurred on a send.
At KeyFA.ps1:36 char:18
+ ... Functions = Invoke-RestMethod -Method GET -Headers @{Authorization = ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
我尝试将其设为 POST 而不是 GET 但同样的错误。
我尝试在浏览器中访问此网址,但浏览器中的错误是:
http 401 表示未经授权。
然后我也尝试从以下位置访问此网址postman正确设置承载身份验证但出现以下错误:
Could not get any response
There was an error connecting to
https://appname_comes_here.azurewebsites.net/admin/functions/
我做错了什么?
无法修复此错误。 Azure 功能站点现在已停止使用该 URL 吗?