question

mandania avatar image
0 Votes"
mandania asked mandania answered

Get ADF v2 parameter into Azure Function Pychon code.

Hi,

Here is the scenario.

I have Azure Function code written in python and correctly deployed to azure. I have also created a pipeline with Copy activity with a DateTime string as a parameter. I wish to pass this parameter to Azure function.How do tell azure function that there is a parameter available to be processed and how do i get it into my pyhon code so i can use and log it? I am not sure if i have to configure my binding file , if so how do i do it? or if there is another way to approach it ?

125580-az-param.jpg

125640-az-param2.jpg


This is my entry point

def main(req: func.HttpRequest) -> func.HttpResponse:


.function.json

{
"scriptFile": "init.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}


azure-functions
az-param.jpg (85.1 KiB)
az-param2.jpg (118.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

mandania avatar image
0 Votes"
mandania answered

I have managed to find the solution to my own problem.

def main(req: func.HttpRequest)-> func.HttpResponse:

    datevalue = req.headers.get("af_datevalue")   

The value is to be defined as a HEADER and not in the body.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.