Question

Difficulty: EasyCreate and Configure Azure Functions

You need to create a new Azure Function App on an Elastic Premium plan using the Azure CLI. Which sequence of commands should you execute? To answer, arrange the steps in the correct order.

  1. 1az group create --name myResourceGroup --location eastus
  2. 2az storage account create --name mystorageaccount --location eastus --resource-group myResourceGroup --sku Standard_LRS
  3. 3az appservice plan create --name myPremiumPlan --resource-group myResourceGroup --sku EP1 --is-linux
  4. 4az functionapp create --name myFunctionApp --resource-group myResourceGroup --storage-account mystorageaccount --plan myPremiumPlan --runtime dotnet-isolated --functions-version 4

Answer

The correct order of commands is to first create the resource group, then create the storage account, followed by creating the Elastic Premium App Service plan, and finally creating the Function App.
The resource group must exist first. Then, the storage account and the App Service plan are created as they have no mutual dependencies but both require the resource group. Finally, the function app is created because it depends on the resource group, the storage account, and the App Service plan.

Step-by-Step Solution

1
Create the Resource Group
az group create --name myResourceGroup --location eastus
All other resources require a resource group to be defined first.
2
Create the Storage Account
az storage account create --name mystorageaccount --location eastus --resource-group myResourceGroup --sku Standard_LRS
The function app relies on standard storage for state and key management.
3
Create the App Service Plan
az appservice plan create --name myPremiumPlan --resource-group myResourceGroup --sku EP1 --is-linux
An Elastic Premium plan (EP1 SKU) is required before assigning the function app to it.
4
Create the Function App
az functionapp create --name myFunctionApp --resource-group myResourceGroup --storage-account mystorageaccount --plan myPremiumPlan --runtime dotnet-isolated --functions-version 4
The function app links the previously created storage account and hosting plan.

Key Concept

Azure Functions resources have creation dependencies: a resource group must exist first, followed by storage and hosting plan resources, before the function app itself can be initialized.
Rate this question