Create an Azure Function App
This guide will walk you through the process of creating a new Azure Function App using the Azure portal.
Before you begin: Ensure you have an active Azure subscription. If you don't have one, you can sign up for a free account.
Method 1: Using the Azure Portal
Step 1: Navigate to the Function App Creation Page
Log in to the Azure portal. In the portal's search bar at the top, type "Function App" and select it from the results. Then, click the "Create" button.
Step 2: Configure Basic Settings
On the "Create" page, you'll need to fill out several fields:
- Subscription: Choose the Azure subscription that will host your Function App.
- Resource Group: Select an existing resource group or create a new one to organize your Azure resources.
- Function App name: Enter a globally unique name for your Function App. This name will form part of the default URL (e.g., your-function-app-name.azurewebsites.net).
- Publish: Choose how you want to deploy your code (e.g., Code + Testfor direct code deployment, orDocker Containerfor containerized applications).
- Runtime stack: Select the programming language and version for your functions (e.g., .NET, Node.js, Python, Java).
- Version: Select the specific version of the runtime stack.
- Region: Choose the Azure region closest to your users for lower latency.
Here's a visual representation:
Step 3: Configure Hosting Settings
Under the "Hosting" tab, you'll configure storage and operating system:
- Storage account: A general-purpose Azure Storage account is required to manage your Function App's state and logs. You can create a new one or select an existing one.
- Operating System: Choose between WindowsorLinux. Linux is often preferred for cost savings and flexibility.
Step 4: Configure Advanced and Networking Settings (Optional)
You can explore the "Advanced" and "Networking" tabs for more detailed configurations such as:
- App Insights for monitoring
- Deployment slots
- VNet integration
- Private endpoints
For a basic setup, these can often be left at their defaults.
Step 5: Review and Create
Click on the "Review + create" button. Azure will validate your configuration. Once validated, click "Create" to provision your Function App.
Tip:
Consider using Azure CLI or ARM templates for infrastructure-as-code (IaC) for repeatable and automated deployments.
Method 2: Using Azure CLI
You can also create a Function App programmatically using the Azure Command-Line Interface (CLI).
Step 1: Install Azure CLI
If you haven't already, install the Azure CLI from the official Azure documentation.
Step 2: Log in to Azure
Open your terminal or command prompt and run:
az loginStep 3: Create Resources
You'll need a resource group and a storage account before creating the Function App. Replace placeholders with your desired names and locations.
# Define variables
RESOURCE_GROUP="myResourceGroup"
STORAGE_ACCOUNT="mystorageaccount$(openssl rand -hex 4)" # Ensure unique storage account name
LOCATION="eastus"
APP_SERVICE_PLAN="myAppServicePlan"
FUNCTION_APP_NAME="myUniqueFunctionAppName$(openssl rand -hex 4)" # Ensure unique function app name
# Create resource group
az group create --name $RESOURCE_GROUP --location $LOCATION
# Create storage account
az storage account create --name $STORAGE_ACCOUNT --location $LOCATION --resource-group $RESOURCE_GROUP --sku Standard_LRS
# Create an App Service plan (Consumption plan for serverless is common)
# For consumption plan, you don't need to explicitly create an App Service Plan in the same way.
# The function app creation will handle it implicitly if you don't specify one.
# If you need a different plan (e.g., Premium, Dedicated), you would create it first.
# Create Function App
az functionapp create \
  --name $FUNCTION_APP_NAME \
  --storage-account $STORAGE_ACCOUNT \
  --resource-group $RESOURCE_GROUP \
  --consumption-plan-location $LOCATION \
  --runtime node \
  --runtime-version 18 \
  --functions-version 4 \
  --os linux # or windows
                Note:
The example uses a Linux-based, Node.js runtime. Adjust --runtime, --runtime-version, --functions-version, and --os to match your needs.
Next Steps
Once your Function App is created, you can start deploying your functions. Refer to our documentation on deploying functions to learn how.
Deploy Your First Function