7

Let's say I have a directory 'foo' that contains my Azure Function Project, built in TypeScript. My structure is like that described in the JavaScript documentation for Azure Function (The TypeScript folder structure is very similar to the JavaScript folder structure). I now want to create a zip file that I can publish to Azure using the Zip Deployment mechanism. How do I create the zip file manually and then publish it to Azure Functions?

Note: I bootstrapped the project using Azure Function Core Tools and am developing in Visual Studio Code on macOS

1 Answer 1

13

First, you will need to build your project. In the case of TypeScript, that involves executing:

npm install
npm run build:production

Then, assuming you are working on a bash shell, you can manually create the zip file using the following command:

zip -r app.zip . --exclude @.funcignore --exclude .funcignore

This command tells zip to zip everything in the current directory except what is in .funcignore and the .funcignore file itself.

After this command completes, you can deploy to Azure using the following Azure CLI command:

az functionapp deployment source config-zip -g ${MY_RESOURCE_GROUP} -n ${MY_APP_NAME} --src app.zip

MY_RESOURCE_GROUP is the resource group in Azure you are publishing into and MY_APP_NAME is the name of your app. (Note: You will have to login to Azure using the CLI first).

1
  • 1
    This just saved me a ton of time. Thank you!
    – lukiffer
    Commented Jan 31, 2020 at 8:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.