Skip to content
Skip to content
Menu
A cup of dev
  • Home
  • About
  • Contact
  • Books and ink
A cup of dev

How to use Azure CLI to deploy Azure Functions: Step-by-Step Guide

By Eli H. Schei on Tuesday, 8 April 2025, 10:17Thursday, 26 June 2025, 10:45

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.

Prerequisites:

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)

Note: This process is specific to Node.js projects. If you’re working with other runtimes like .NET, Python, or Java, make sure to build your project according to that language’s standard build pipeline before zipping and deploying.
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

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X

Post navigation

Give your app granular permissions to a specific site or list in SharePoint
How to Get Site-ID with Graph Explorer (and other SharePoint info)

Leave a ReplyCancel reply

Eli H. Schei

I'm a front-end developer who mainly work in the Microsoft 365-sphere. As a developer I read a lot of blogs. And in my experience I can read multiple different blogposts about exactly the same topic, and only one of them makes sense to me. Therefore I’m adding my voice to the mix, and hopefully one of my blogposts will be the one that makes sense of a topic for you. You can learn more about me here.

Recent Posts

  • How to Get Site-ID with Graph Explorer (and other SharePoint info)
  • How to use Azure CLI to deploy Azure Functions: Step-by-Step Guide
  • Give your app granular permissions to a specific site or list in SharePoint
  • Microsoft Graph Magic: Simplifying User Removal from teams in Microsoft Teams
  • How to leverage teams-js in your Teams app; Working with user context and SharePoint site context

Categories

  • Azure
    • Azure CLI
    • Azure functions
  • Level
    • Beginner
    • Intermediate
  • Microsoft 365 Development
    • Microsoft Authentication Library
    • Microsoft Graph
    • Microsoft Teams
    • PNP powershell
    • PowerApps
      • PowerApps Component Framework
    • SharePoint Framework
    • SharePoint Online
  • Tech Lead
  • Web development
    • Accessibility
    • Soft skills
    • Tips and tricks

Tags

accessibility app permissions ARIA azure Azure CLI azure functions Content creation custom themes favorites git github M365 CLI M365 development MS Graph PCF PnPjs PnP powershell power apps PowerApps Component Framework quicktip react resources SharePoint Online Sideloading SPfx Teams teams app dev Teams apps Tech lead tools wcag webdev Windows terminal
©2025 A cup of dev | WordPress Theme by SuperbThemes.com