Skip to content

Files

Latest commit

 

History

History
79 lines (51 loc) · 3.52 KB

functions-create-azure-resources-cli.md

File metadata and controls

79 lines (51 loc) · 3.52 KB
author ms.service ms.topic ms.date ms.author
ggailey777
azure-functions
include
08/18/2021
glenga

Create supporting Azure resources for your function

Before you can deploy your function code to Azure, you need to create three resources:

  • A resource group, which is a logical container for related resources.
  • A Storage account, which is used to maintain state and other information about your functions.
  • A function app, which provides the environment for executing your function code. A function app maps to your local function project and lets you group functions as a logical unit for easier management, deployment, and sharing of resources.

Use the following commands to create these items. Both Azure CLI and PowerShell are supported.

  1. If you haven't done so already, sign in to Azure:

    az login
    

    The az login command signs you into your Azure account.

    Connect-AzAccount
    

    The Connect-AzAccount cmdlet signs you into your Azure account.


  2. Create a resource group named AzureFunctionsQuickstart-rg in your chosen region:

    az group create --name AzureFunctionsQuickstart-rg --location <REGION>
    

    The az group create command creates a resource group. In the above command, replace <REGION> with a region near you, using an available region code returned from the az account list-locations command.

    New-AzResourceGroup -Name AzureFunctionsQuickstart-rg -Location <REGION>
    

    The New-AzResourceGroup command creates a resource group. You generally create your resource group and resources in a region near you, using an available region returned from the Get-AzLocation cmdlet.


  3. Create a general-purpose storage account in your resource group and region:

    az storage account create --name <STORAGE_NAME> --location <REGION> --resource-group AzureFunctionsQuickstart-rg --sku Standard_LRS --allow-blob-public-access false
    

    The az storage account create command creates the storage account.

    New-AzStorageAccount -ResourceGroupName AzureFunctionsQuickstart-rg -Name <STORAGE_NAME> -SkuName Standard_LRS -Location <REGION> -AllowBlobPublicAccess $false
    

    The New-AzStorageAccount cmdlet creates the storage account.


    In the previous example, replace <STORAGE_NAME> with a name that is appropriate to you and unique in Azure Storage. Names must contain three to 24 characters numbers and lowercase letters only. Standard_LRS specifies a general-purpose account, which is supported by Functions.

[!INCLUDE functions-storage-access-note]