I am unable to get my Azure Function to trigger when hosted on azure, using azure service bus queues as a trigger. It works fine when its run locally, but doesn't remotely.
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "serviceBusTrigger",
"direction": "in",
"AzureWebJobsStorage": "AzureWebJobsStorage",
"queueName": "selectivitycalculation",
"connection": "AzureServiceBusConnectionString"
}
]
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": XXXXXX,
"AzureServiceBusConnectionString": XXXXXXX
}
}
host.json
{
"version": "2.0",
"extensions": {
"serviceBus": {
"prefetchCount": 100,
"messageHandlerOptions": {
"autoComplete": false,
"maxConcurrentCalls": 32,
"maxAutoRenewDuration": "00:55:00"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"functions": [ "SelectivityCalculation" ],
"logging": {
"fileLoggingMode": "debugOnly",
"logLevel": {
"Function.MyFunction": "Information",
"default": "None"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond" : 20
}
}
}
}
__init__.py
import azure.functions as func
import logging
import sys
from .azure_functions_controller import selectivity_callback
def main(msg: func.ServiceBusMessage):
logger.info('Python ServiceBus queue trigger processed message.')
print('working')
selectivity_callback(msg.get_body())
Folder Structure
Calculator
| - __app__
| | - SelectivityCalculation
| | | - __init__.py
| | | - azure_functions_controller.py
| | | - functions.json
| | - SharedCode
| | | - ...
| | - host.json
| | - bin
And my application settings on Azure
My dev environment is as follows:
1) Windows 10 Pro 2) VS Code 1.41.1 3) Azure Functions CLI 2.7.1948 4) Python 3.7.4
PrefetchCount
tohost.json
. – Marco