arguments in http trigger azure python functions

Chaithra Siddappa 20 Reputation points
2023-02-22T14:54:05.0066667+00:00

Hi,

I am trying to use azure functions to give input parameters such as file paths and user name, using which azure functions download the files (from file paths) to another container ( foldername will be username and timestamp ) when the http trigger is made.
Everything seems to be running in local envrt when I pass parameters as :

http:localhost:7071/api/myfunction?file_paths=file1.txt,file2.txt&username=xyz

the files are downloaded the way I wanted. but when I deployed and tried to do the same

url?file_paths=file1.txt,file2.txt&username=xyz

this does not work. I get a 401 error. I tried looking into the access of storage accounts(I made "enabled from all networks")

and tried hardcoding the file paths and user name. It works.

So, I believe the problem is in the way I pass arguments.

Could someone pass any inputs/suggestions what to take care of ?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,908 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-02-27T06:35:35.19+00:00

    @Chaithra Siddappa Thanks for reaching out. Can you try adding logging to your function code to verify whether your code is able to get the query parameter values correctly when you run the function on azure. As per the 401 error it looks like an authentication issue. Without more details on the full exception whether the exception is generated from function app or storage account it would not be possible to pinpoint where exactly the authentication failed.

    You can review the application insights log on your function to get more details whether the error is from function app or storage account.

    Further I will suggest you to validate if the application settings are the same in your local environment and in azure. There may be chances that your code relay on some setting just to eliminate this case.

    The above and more logs/application insights logs should give you more insights on this issue. You can always leverage the diagnostic and solve problem blade on your function app to know more details on the issue and mitigation steps to resolve these issues.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.