2

In the same way that you would deploy a storage account or a upload a blob file from Python.

I am essentially looking for the Python equivalent of the following bash commands

  1. az functionapp create --resource-group $RESOURCE_GROUP_NAME --os-type Linux --consumption-plan-location $AZ_LOCATION --runtime python --runtime-version 3.6 --functions-version 2 --name $APP_NAME --storage-account $STORAGE_ACCOUNT_NAME

  2. func new --name $FUNC_NAME --template "Azure Queue Storage trigger"

  3. func azure functionapp publish $APP_NAME --build-native-deps

A cop-out would be to just have the Python script run the shell commands, but I am looking for a more elegant solution if one exists.

3
  • Have you tried the azure-function SDK: pypi.org/project/azure-functions Commented Jan 6, 2021 at 5:51
  • I have. Unclear to me how you would use it for native Python deployment from a script and I can't find any examples in the documentation of that. May just end up running the above as external commands. Commented Jan 6, 2021 at 6:06
  • Perhaps: learn.microsoft.com/en-us/azure/azure-functions/… Commented Jan 6, 2021 at 6:46

1 Answer 1

1

I am essentially looking for the Python equivalent of the following bash commands

If you check the python sdk of azure or check the REST API document of azure, you will find there is no Ready-made method.Basically, there are two situations to discuss:

If you want to deploy azure function to windows OS, then just use any python code to upload local function structure to related storage file share(The premise is that the function app has been created on azure.).

But if you want to deploy azure function to linux OS, then it will not be as simple as deploying to windows OS. It needs to perform additional packaging operations, and the specific logic may need to check the underlying implementation of azure cli.

A cop-out would be to just have the Python script run the shell commands, but I am looking for a more elegant solution if one exists.

For Linux-based azure function, I think you don’t have to consider so much. It has many additional operations when deploy function app, so use command or run command by python to achieve this is more recommended(There is no ready-made python code or REST API that can do what you want.).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.