Deploying your code to Azure Functions using the Azure CLI is a fast, scriptable, and repeatable way to bring your serverless applications to the cloud. Whether you’re working with .NET, TypeScript/Node, Python, or another supported language, the Azure CLI allows you to automate the deployment process and integrate it into your development or CI/CD workflow. In this post, we’ll walk through how to package and deploy your Azure Function using the az functionapp
command and ensure it’s up and running in just a few steps.
Azure CLI installed (version 2.30.0 or later recommended), an existing Azure Function App, Azure subscriotion and Resource Group — or permission to create them. And lastly a zip utility or Compress-Archive (PowerShell) to create a deployment package.
Logging in and Selecting the Right Subscription
Before deploying anything, you need to authenticate with Azure and make sure you’re working in the correct subscription. Use az login
to sign in, and if your account has access to multiple subscriptions, set the one you want with az account set --subscription "<subscription-name-or-id>"
. This ensures all your CLI commands target the right Azure environment.
az login #set subscription az account set --subscription "Subscription Name or ID"
Verifying Your Function App Exists
To confirm that your Azure Function App is available and that you’re deploying to the correct one, use the az functionapp show
command. This will return details about the app, such as its location, runtime stack, and status. It’s a good sanity check before pushing any code
az functionapp show --resource-group <ResourceGroupName> --name <FunctionAppName>
If the command returns app metadata, you’re good to go. If not, double-check the name and resource group.
Build, Zip, and Deploy Your Function App
Once your project is ready, it’s time to build it, package it, and deploy it. For a Node.js or TypeScript Azure Functions app, start by installing dependencies and compiling the project (if applicable)
npm install npm run build
Then, create a zip package of your built files. If you’re using TypeScript and output to a dist
folder, make sure you zip the contents of that folder — not the folder itself
Compress-Archive -Path * -DestinationPath functionapp.zip
Finally, deploy the zip package using the Azure CLI:
az functionapp deployment source config-zip \ --resource-group <ResourceGroupName> \ --name <FunctionAppName> \ --src functionapp.zip
Summary
Using the Azure CLI to deploy Azure Functions gives you full control over your deployment process without relying on external tools or portals. Whether you’re automating deployments as part of a CI/CD pipeline or just want a fast way to push updates, the CLI offers a powerful and flexible option. By combining the right build steps, packaging your app correctly, and using the az functionapp
commands, you’re able to get your code live in just a few minutes.
Resources
Here are some helpful links to the official Microsoft documentation:
- Install the Azure CLI
- az login command reference
- az account set command reference
- az functionapp show
- Deploy your code with ZIP
- Build and run Azure Functions locally
- Azure Functions supported languages and runtimes
If you are interested in Microsoft 365 Development you might also like my other blogposts in this category.
Also, if you have any feedback or questions, please let me know in the comments below. 🙂
Thank you for reading, and happy coding!
/Eli
If you want to support my content you can