0

I have created a azure function in java created Using Command line by following below given Microsoft guide https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java

I have followed all the steps, but while running function locally using command as attached in below screenshot. Running function locally

I am getting the following error:

error

Anyone please help me in resolving the above error to run the azure function locally.

Thanks & Regards, Preethi H R

  • try uninstall and install again of Azure Function Core tools. Also, if you are connected to corp network, disconnect and try on home or private network, similar [issue](https://github.com/microsoft/vscode-azurefunctions/issues/1731) – Anand Sowmithiran Sep 13 '22 at 13:04

1 Answers1

0
  • This might be the known bug in the azure function extension bundle. So a work around for that, in your project remove the following code from the host.json file
"extensionBundle": {

"id": "Microsoft.Azure.Functions.ExtensionBundle",

"version": "[3.*, 4.0.0)"

}

enter image description here

  • Then restart the project with the following command
 mvn -e  azure-functions:run

enter image description here

Refer the work around given in this question

Mohit Ganorkar
  • 1,917
  • 2
  • 6
  • 11
  • Hi, Thank you for your reply. Indeed the solution helped me in deploying the Java function locally. Following the same tutorial https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java I am trying to deploy into azure but I am getting following error – Preethi H R Sep 14 '22 at 07:32
  • [ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.19.0:deploy (default-cli) on project acc-functions: load Function app (acc-functions-20220908124034280): Status code 403, "{"error":{"code":"AuthorizationFailed","message":"The client 'preethi.h.r@accenture.com' with object id 'b0a578e0-4c3a-40d3-b487-41f846871419' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions/8aea60a3-ae35-41be-ab84-184c32be829f/resourceGroups/java-functions-group/providers/Microsoft.Web/sites/acc-functions-20220908124034280' – Preethi H R Sep 14 '22 at 07:38
  • this is an auth issue check your subscription whether you have auth to do this – Mohit Ganorkar Sep 14 '22 at 07:49
  • Do I require any specific permissions for deployment? and will the deployment create only new resources? Cannot we make use of existing resources for deployment? – Preethi H R Sep 14 '22 at 07:54
  • permissions are related to the role that is assigned to you refer this https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles – Mohit Ganorkar Sep 22 '22 at 20:08
  • Sure will check on the link. Thank you. – Preethi H R Sep 28 '22 at 09:50