This template repo serves as a flavor of quick-starter development container for use with VS Code Remote - Containers and GitHub Codespaces.
Originally, this dev container was created to tryout cloud native apps and services development using Azure Functions (Isolated) and .NET apps and services without having to install locally.
- Azure Functions v4 and Core Tools latest binaries
- .NET 6.0 SDK and Runtime
- Azure CLI for publishing and managing cloud resources
- Kubernetes and Helm CLI for container orchestration
- VS Code Extensions for .NET and Azure-related work
- VS Code Tasks to build, launch, and debug from source
- EditorConfig for .NET and C# coding standards
- Git and GitHub CLI for versioning
- ZSH integrated Terminal
- Docker CLI with Compose v2
If you are completely new to functions, Awesome Functions - Isolated discussion is a good source to start with.
Next, you want to create a copy of this template. It is easy as forking. The repo is marked as a Template
so you will only have to Use This Template and follow the instructions.
First, you want to ensure source code is Reopened in Container. Then you'll be able to work with it like you would locally.
With VS Code:
- In a terminal, run
func --version
to verify Azure Functions Core Tool are version 4.x. - Run
dotnet --list-sdks
to verify required versions are installed. - Run
az --version
to verify Azure CLI version is 2.4 or above.
Next, you would want to create a serverless app, say, a functions app test-project
that response to an HTTP trigger.
With VS Code:
- Run the
func init
command to create a functions project with specific runtime.func init test-project \ --worker-runtime dotnet-isolated \ --target-framework net6.0 \ && cd test-project
- Add a function to the project, say,
HttpExample
with HTTP trigger.func new -n HttpExample \ -t "HTTP trigger" \ --authlevel "anonymous"
VS Code is integrated with the Azure Functions Core Tools to run the functions app on the local development computer, in this case, its this dev container.
With VS Code:
- Press
F5
to start the functions app project and call the function. The terminal displays the output from the Core Tools. - When the function executes locally, a notification is raised in VS Code to spin up your favorite browser.
- Visit https://localhost:7071/api/httpexample
- Press
Ctrl+C
to stop Core Tools and disconnect the debugger.
Before publishing the functions app to Azure, you want to create supporting resources for the function.
- Create an Azure account for free, if you haven't already.
- Run
az login
to sign into your Azure account, if you haven't already. - Create a resource group, a general pupose storage account, and a functions app in Azure.
- When the resources are ready, deploy the functions app to Azure.
# Publish using Zip deployment dotnet build --configuration Release dotnet publish --configuration Release --output .publish # az functionapp deployment source config-zip -g <resource-group-name> -n <functionapp-name> --src .publish/drop.zip az functionapp deployment source config-zip -g az-funcs-sandbox -n vscode-remote-try-azure-functions --src .publish/drop.zip
If you have any technical problems with GitHub Codespaces or dev containers, you are better off asking VS Code Support directly, since you'll end up getting a much faster response back that way.
The official repo to contribute would be @microsoft/vscode-dev-containers.
Have a suggestion or a bug fix? Just open a pull request or an issue. Include the development container with clear and simplest instructions possible.
Copyright (c) Kosala Nuwan Perera. All rights reserved.
The source code is license under the MIT license.