Function as a Service
Varianten mit CLI
- mit Core Tools (
func ...) - mit Azure Developer CLI (
azd ...)
Links
- Microsoft Learn Azure - Create a function app for serverless code execution
- Microsoft Learn Azure - Develop Azure Functions by using Visual Studio Code
- Microsoft Azure Learn - Quickstart: Create a JavaScript function in Azure from the command line (Azure Functions Core Tools)
Funktionsressource erstellen
Azure Portal (Microsoft Learn Azure - Functions Documentation - Create a function app in the Azure portal)
- Ressource Function App erstellen
- Flex Consumption anwählen
- Select
- Einstellungen vornehmen
- Review + create
- Notifications (Icon rechts oben) öffnen
- Auf Benachrichtigung warten
- 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)
-
Voraussetzungen
- Azure Functions Core Tools herunterladen (siehe Link oben)
-
Projekt erstellen
func init <project-folder-name> --worker-runtime <runtime> --model <V3|V4>Beispiele:
func init MyFunctionProject --worker-runtime javascript --model V4 -
weitere Funktionen in Projekt unter
src/functionserstellenfunc 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
- Voraussetzungen
- Azure Functions extension herunterladen
- Azure Tools Extension pack herunterladen
- Command
Azure Functions: Create New Project...oderAzure Functions: Create New Containerized Project...ausführen (Command Palette mitF1öffnen)- Ordner für Projekt auswählen
- Sprache auswählen
- Vorlage für erste Funktion auswählen: HTTP trigger, Skip for now, ….
- Name für Projekt eingeben
- weitere Funktionen in Projekt erstellen
- Command
Azure Functions: Create Function...ausführen
- Command
Azure Functions Projekt deployen
CLI (Microsoft Learn Azure - Functions Documentation - Develop Azure Functions locally using Core Tools)
-
Voraussetzungen
- Azure Functions Core Tools herunterladen (siehe Link oben)
-
lokales Projekt in schon erstellte Ressource FunctionApp deployen
func azure functionapp publish <FunctionAppName>
Visual Studio Code
- Projekt in dem Funktions-Projekt-Ordner öffnen
- Command
Azure Functions: Deploy to Function Appausführen