I am having the following issue with Azure Functions and Azure DataLake Gen2 connection:
Running the function locally everything works fine. It connects to the datalake, gets the input file, processes some logic and then upload the modified file to a new location within the datalake. See the integration overview below:
__init__.py
import logging
import xml.etree.ElementTree as ET
import azure.functions as func
def main(req: func.HttpRequest, inputBlob: func.InputStream, outputBlob: func.Out[func.InputStream]) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
try:
data = inputBlob.read()
xml = ET.fromstring(data.decode('utf-8'))
# for loop here to perform some logic.
outputBlob.set(ET.tostring(xml))
return func.HttpResponse(
"This HTTP triggered function executed successfully.",
status_code=200
)
except ValueError as ex:
return func.HttpResponse(
"Unknown error has occured tih message: " + str(ex),
status_code=400
)
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"type": "blob",
"direction": "in",
"name": "inputBlob",
"path": "https://.xml",
"connection": "APP SETTING NAME"
},
{
"type": "blob",
"direction": "out",
"name": "outputBlob",
"path": "https://.xml",
"connection": "APP SETTING NAME"
}
]
}
- I am using bindings to make the connection to the inputBlob and outputBlob.
- I registered an APPLICATION SETTING to ensure the connection (format: DefaultEndpointsProtocol=https;AccountName=####;AccountKey=####;EndpointSuffix=core.windows.net). Similar as in local.settings.json
Running the trigger I keep getting the following error:
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
I found this:Stack overflow post saying outputbindings don't work with datalakes, but I am confused why the local run works then?
Does anyone recognize this problem and if so have a way forward for me?
Kind regards,
Mark