提问人:Michael Shepard 提问时间:11/2/2023 最后编辑:Santiago SquarzonMichael Shepard 更新时间:11/2/2023 访问量:82
尝试在 powershell runbook Azure 自动化帐户中调用 API 时出现错误 499
Getting error 499 when attempting to call API within a powershell runbook Azure automation account
问:
当我尝试在 powershell runbook 中调用 Azure API 时,收到错误 499 响应。我假设存在超时问题。如果是这样,我应该在代码中采取哪些步骤来防止超时发生?代码如下:
$uri = "https://xxxxxxxx-xxxxxxxx-prod-api.azurewebsites.net/api/PortfolioExport?PortfolioBatchDate=9/9/9999"
$tenantId = "xxxxxxxx-xxxx-xxxx-xxxx-7181039d1ed4"
$clientId = "xxxxxxxxxxxx-xxxx-xxxx-xxxx-5268b21e2920"
$clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxx~~U7n06yxQlc49"
$resource = "https://xxxxx.com/xxxxx.riskanalysis.app"
$tokenEndpoint = "https://login.microsoftonline.com/$tenantId/oauth2/token"
$body = @{
grant_type = "client_credentials"
client_id = $clientId
client_secret = $clientSecret
resource = $resource
audience = $resource # Specify the audience parameter here
}
$response = Invoke-RestMethod -Method Post -Uri $tokenEndpoint -Body $body
$accessToken = $response.access_token
$headers = @{
Authorization = "Bearer $accessToken"
}
Invoke-RestMethod -Method POST -Uri $uri -Headers $headers
答: 暂无答案
评论
xxxxxxxx-xxxxxxxx-prod-api.azurewebsites.net
Start-Sleep