Zum Hauptinhalt springen

Function as a Service

Varianten mit CLI

  1. mit Core Tools (func ... )
  2. mit Azure Developer CLI (azd ... )

Links

Funktionsressource erstellen

Azure Portal (Microsoft Learn Azure - Functions Documentation - Create a function app in the Azure portal)

  1. Ressource Function App erstellen
  2. Flex Consumption anwählen
  3. Select
  4. Einstellungen vornehmen
  5. Review + create
  6. Notifications (Icon rechts oben) öffnen
  7. Auf Benachrichtigung warten
  8. Go to resource auf Benachrichtigung

CLI

az storage account create --name bbcssteilfirststorage --location "France Central" --resource-group bbcssteilResourceGroup --sku Standard_LRS --allow-blob-public-access false

az functionapp create --resource-group bbcssteilResourceGroup --consumption-plan-location westeurope --runtime node --runtime-version 20 --functions-version 4 --name bbcssteilLehrabschlussFunction --storage-account bbcssteilfirststorage

Azure Functions Projekt erstellen und Funktionen erstellen

CLI (Microsoft Learn Azure - Functions Documentation - Develop Azure Functions locally using Core Tools)

  1. Voraussetzungen

    1. Azure Functions Core Tools herunterladen (siehe Link oben)
  2. Projekt erstellen

    func init <project-folder-name> --worker-runtime <runtime> --model <V3|V4>

    Beispiele:

    func init MyFunctionProject --worker-runtime javascript --model V4
  3. weitere Funktionen in Projekt unter src/functions erstellen

    func new --template "<template>" --name <func-name>

    Beispiele:

    func new --template "Http Trigger" --name MyHttpTrigger
    func new --template "Azure Queue Storage Trigger" --name MyQueueTrigger

Visual Studio Code

  1. Voraussetzungen
    1. Azure Functions extension herunterladen
    2. Azure Tools Extension pack herunterladen
  2. Command Azure Functions: Create New Project... oder Azure Functions: Create New Containerized Project... ausführen (Command Palette mit F1 öffnen)
    1. Ordner für Projekt auswählen
    2. Sprache auswählen
    3. Vorlage für erste Funktion auswählen: HTTP trigger, Skip for now, ….
    4. Name für Projekt eingeben
  3. weitere Funktionen in Projekt erstellen
    1. Command Azure Functions: Create Function... ausführen

Azure Functions Projekt deployen

CLI (Microsoft Learn Azure - Functions Documentation - Develop Azure Functions locally using Core Tools)

  1. Voraussetzungen

    1. Azure Functions Core Tools herunterladen (siehe Link oben)
  2. lokales Projekt in schon erstellte Ressource FunctionApp deployen

    func azure functionapp publish <FunctionAppName>

Visual Studio Code

  1. Projekt in dem Funktions-Projekt-Ordner öffnen
  2. Command Azure Functions: Deploy to Function App ausführen