Danyal Imran
Danyal Imran

Reputation: 2605

Permission Denied when deploying .zip Function App using Azure CLI

I was following this documentation that indicates how to deploy a zip file to azure function apps using the azure cli: https://learn.microsoft.com/en-us/cli/azure/functionapp/deployment/source?view=azure-cli-latest#az-functionapp-deployment-source-config-zip

I logged in to azure via the command (the login was successful and it generated a json object in return)

az login

After that I ran the command to deploy zip file to the function app

az functionapp deployment source config-zip --name testmigfuncapp --resource-group g_rscgroup --src "C:\Code\Azure Functions\Proj"

In response I get

[Errno 13] Permission denied: 'C:\\Code\\Azure Functions\\Proj'
Traceback (most recent call last):
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\knack\knack\cli.py", line 197, in invoke
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 373, in execute
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\six\six.py", line 693, in reraise
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 347, in execute
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands\__init__.py", line 182, in __call__
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\__init__.py", line 440, in default_command_handler
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-appservice\azure\cli\command_modules\appservice\custom.py", line 257, in enable_zip_deploy
PermissionError: [Errno 13] Permission denied: 'C:\\Code\\Azure Functions\\Proj'

I am on windows machine, running windows 10. PS: If anyone could guide me on how does Visual Studio Code deploys to function app via its function app extension, that would be great (I need to know about CLI deployment since I need to deploy from on-premises via command line since there is no visual studio code there).

Upvotes: 2

Views: 2247

Answers (1)

Joy Wang
Joy Wang

Reputation: 42063

I can reproduce your issue, it was caused by the --src, you missed the .zip, it should be a zip file path location like C:\Code\Azure Functions\Proj.zip, add it, then will work fine.

enter image description here enter image description here

Upvotes: 4

Related Questions