我正在使用Azure Devops管道部署Azure功能:https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-function-app-v1?view=azure-pipelines
- task: AzureFunctionApp@1
displayName: 'Deploy functions to Function App'
inputs:
azureSubscription: Subscription
appType: functionAppLinux
appName: 'functionX'
package: $(System.DefaultWorkingDirectory)/functions.zip
resourceGroupName: $(resourcegroup)
所有工作正常,部署无误。问题是该功能从未触发,并且每分钟都触发一次。Azure门户中有以下消息:Your app is currently in read only mode because you are running from a package file. To make any changes update the content in your zip file and WEBSITE_RUN_FROM_PACKAGE app setting
.
如何从Azure管道部署可以实际工作(被触发)的功能?
添加的功能代码:
module.exports = function (context, scaleUpTimer) {
var timeStamp = new Date().toISOString();
if(scaleUpTimer.isPastDue)
{
context.log('JavaScript is running late!');
}
context.log('JavaScript timer trigger function ran!', timeStamp);
context.done();
};
P. S定位问题:手动和自动之间的绑定不同。
手册:
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
}
自动化:
"bindings": [
{
"name": "UpTimerDummy",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
},
{
"type": "queue",
"name": "operationRequest",
"queueName": "operations-queue",
"connection": "AzureWebJobsStorage",
"direction": "out"
}
我猜我对AzureWebJobsStorage或操作队列都没有权限。
1条答案
按热度按时间rekjcdws1#
此部署任务有效。请检查部署结果:
检查您的函数内容...此外,您可以通过“测试/运行”按钮手动运行它:
使用
async
关键字测试函数,如下所示:https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-javascript#example