我可以运行需要运行 1 小时以上的预定 ps Azure 函数吗?我已经尝试过消费和高级计划,但预定的 Azure 功能由于超时而卡住了。
更新
我尝试让 AAD 中的所有小组成员都加入。我运行这个 ms graph url:
https://graph.microsoft.com/v1.0/groups?$top=999&$expand=members
但是因为群组成员有 999 人,所以我需要使用寻呼功能。请参阅下面的代码片段:
$allPages = @()
$items = (Invoke-RestMethod -Method 'Get' -Uri 'https://graph.microsoft.com/v1.0/groups?$top=999&$expand=members' -Headers $authHeader -ContentType 'Application/Json')
$allPages += $items.value
$index = 0
if ($items.'@odata.nextLink') {
do {
$index++
"Index counter: $index"
$token = (Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com/").Token
$authHeader = @{Authorization = "Bearer $token"}
$items = (Invoke-RestMethod -Method 'Get' -Uri $items.'@odata.nextLink' -Headers $authHeader -ContentType 'Application/Json')
$allPages += $items.value
} until (
!$items.'@odata.nextLink'
)
}
$items = $allPages
"Count items: " + $items.Count
$filePath = "D:\home\data\$($fileName)"
Write-Host "Convert to csv to path '$($filePath)'" -ForegroundColor green
$items | Export-Csv -NoTypeInformation -Path $filePath
我可以运行需要运行 1 小时以上的 Azure Functions 吗?
是的,您可以运行 Azure 函数超过一小时。
在host.json
中设置
functionTimeout属性:
{
"functionTimeout":"02:00:00"
}
functionTimeout
属性设置函数的超时。{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"managedDependency": {
"enabled": true
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"functionTimeout":"02:00:00"
}
回复: