Azure CLI publish python app function error Can't find app with name
Question:
Trying to publish a Python Azure function app to Azure and getting this error:
(.venv) PS C:UsersjmatsonsourcereposfuntionAppPythonGetInSiteTasks> func azure functionapp publish functionAppPythonGetInSiteTasks --remote
Can’t find app with name “functionAppPythonGetInSiteTasks”
Directory structure:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/10/2019 11:06 AM .venv
d----- 3/10/2019 11:04 AM .vscode
d----- 3/10/2019 11:25 AM functionAppPythonGetInSiteTasks
-a---- 3/10/2019 11:03 AM 2 .funcignore
-a---- 3/10/2019 11:03 AM 437 .gitignore
-a---- 3/10/2019 11:03 AM 27 host.json
-a---- 3/10/2019 11:21 AM 297 local.settings.json
-a---- 3/10/2019 12:44 PM 612 requirements.txt
Sub directory:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/10/2019 12:42 PM __pycache__
-a---- 3/10/2019 11:04 AM 333 function.json
-a---- 3/10/2019 12:43 PM 1080 __init__.py
Empty function app exists in Azure:
Answers:
I ended up ‘solving’ this, by removing the function app from Azure (via the UI) and then re-creating it, and re-uploading via the azure CLI. I’m unclear why this had the effect it did.
I couldn’t help but notice that the names of the function mentioned in your publish command and the one that exists on Azure mismatch (functionAppPythonGetInSiteTasks vs funtionAppPythonGetInSiteTasks). Could be a trivial observation, but try with the exact name?
FYI: I ran into this issue running a Python script to manage deployment of a Python Azure Function. I solved it by running time.sleep(30)
, because it actually takes Azure a few seconds to bring the Function App to a state where you can publish to it. Very annoying bug.
Make sure that you are giving the correct function app name. If you are not sure about your function app name then please run the below command to get the list of possible function apps that you can publish to.
$az functionapp list –query "[].name"
Sample output:
[
"azuswfntest123"
]
then run the actual command to publish the function app code.
$func azure functionapp publish azuswfntest123
I had the same issue and I solved it by adding service principal I am using to login to azure cli to role assignments of azure function as Contributor or Owner. So just a heads up, this might be an access issue that the user you logged in with does not have.
Trying to publish a Python Azure function app to Azure and getting this error:
(.venv) PS C:UsersjmatsonsourcereposfuntionAppPythonGetInSiteTasks> func azure functionapp publish functionAppPythonGetInSiteTasks --remote
Can’t find app with name “functionAppPythonGetInSiteTasks”
Directory structure:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/10/2019 11:06 AM .venv
d----- 3/10/2019 11:04 AM .vscode
d----- 3/10/2019 11:25 AM functionAppPythonGetInSiteTasks
-a---- 3/10/2019 11:03 AM 2 .funcignore
-a---- 3/10/2019 11:03 AM 437 .gitignore
-a---- 3/10/2019 11:03 AM 27 host.json
-a---- 3/10/2019 11:21 AM 297 local.settings.json
-a---- 3/10/2019 12:44 PM 612 requirements.txt
Sub directory:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/10/2019 12:42 PM __pycache__
-a---- 3/10/2019 11:04 AM 333 function.json
-a---- 3/10/2019 12:43 PM 1080 __init__.py
Empty function app exists in Azure:
I ended up ‘solving’ this, by removing the function app from Azure (via the UI) and then re-creating it, and re-uploading via the azure CLI. I’m unclear why this had the effect it did.
I couldn’t help but notice that the names of the function mentioned in your publish command and the one that exists on Azure mismatch (functionAppPythonGetInSiteTasks vs funtionAppPythonGetInSiteTasks). Could be a trivial observation, but try with the exact name?
FYI: I ran into this issue running a Python script to manage deployment of a Python Azure Function. I solved it by running time.sleep(30)
, because it actually takes Azure a few seconds to bring the Function App to a state where you can publish to it. Very annoying bug.
Make sure that you are giving the correct function app name. If you are not sure about your function app name then please run the below command to get the list of possible function apps that you can publish to.
$az functionapp list –query "[].name"
Sample output:
[
"azuswfntest123"
]
then run the actual command to publish the function app code.
$func azure functionapp publish azuswfntest123
I had the same issue and I solved it by adding service principal I am using to login to azure cli to role assignments of azure function as Contributor or Owner. So just a heads up, this might be an access issue that the user you logged in with does not have.