{"id":23046933,"url":"https://github.com/matsest/azure-functions-demo","last_synced_at":"2025-07-03T16:31:56.860Z","repository":{"id":106353133,"uuid":"426796038","full_name":"matsest/azure-functions-demo","owner":"matsest","description":"Azure Functions with golang + Bicep + GitHub Actions","archived":false,"fork":false,"pushed_at":"2025-05-05T09:52:42.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T09:05:30.061Z","etag":null,"topics":["azure","azure-functions","bicep","biceplang","demo","golang","serverless"],"latest_commit_sha":null,"homepage":"","language":"Bicep","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matsest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-10T22:25:30.000Z","updated_at":"2025-05-05T09:52:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"da764884-a6ea-4cb4-8e26-5ad03c4909b2","html_url":"https://github.com/matsest/azure-functions-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matsest/azure-functions-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matsest%2Fazure-functions-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matsest%2Fazure-functions-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matsest%2Fazure-functions-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matsest%2Fazure-functions-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matsest","download_url":"https://codeload.github.com/matsest/azure-functions-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matsest%2Fazure-functions-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263360758,"owners_count":23454780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-functions","bicep","biceplang","demo","golang","serverless"],"created_at":"2024-12-15T22:30:05.817Z","updated_at":"2025-07-03T16:31:56.838Z","avatar_url":"https://github.com/matsest.png","language":"Bicep","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Azure Functions Demo\n\n[![Deploy](https://github.com/matsest/azure-functions-demo/actions/workflows/deploy-function-app.yml/badge.svg)](https://github.com/matsest/azure-functions-demo/actions/workflows/deploy-function-app.yml)\n\nThis repo contains code to deploy an Azure Function in a declarative fashion. The following tools are used:\n\n- :gear: [GitHub Actions Workflow](https://docs.github.com/en/actions/quickstart): End-to-end deployment and build of all components\n- :muscle: [Bicep](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep): infrastructure-as-code for Azure Resources\n- :zap: [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions): source code for the function in golang\n\nThe deployed function is a simple demo function that prints out a greeting and accepts a name parameter, based on the guide [here](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-other?tabs=go%2Cwindows#configure-your-environment).\n\n```bash\n$ curl https://\u003cfunctionapp_name\u003e.azurewebsites.net/api/hello?name=Mats\n\nHello, Mats. This HTTP triggered function executed successfully.\n\n$ curl https://\u003cfunctionapp_name\u003e.azurewebsites.net/api/hello\n\nThis HTTP triggered function executed successfully. Pass a name in the query string for a personalized response.\n```\n\n## Requirements\n\n- An Azure subscription with a resource group deployed\n- A service principal with Contributor permissions to the resource group\n  - Add credentials as repository secrets to `AZURE_CREDENTIALS`\n\n\u003cdetails\u003e\n\n```bash\n# Set up az cli: https://docs.microsoft.com/en-us/cli/azure/get-started-with-azure-cli\n\n$ az group create -l {location} -n {resource group}\n\n$ az ad sp create-for-rbac --name \"myApp\" --role contributor \\\n                         --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}\n                         --sdk-auth\n\n# Replace {subscription-id}, {resource-group}, and {app-name} with\n# the names of your subscription, resource group, and Azure function app.\n\n# The command should output a JSON object similar to this:\n\n{\n  \"clientId\": \"\u003cGUID\u003e\",\n  \"clientSecret\": \"\u003cGUID\u003e\",\n  \"subscriptionId\": \"\u003cGUID\u003e\",\n  \"tenantId\": \"\u003cGUID\u003e\",\n  (...)\n}\n\n# Copy this and add as a repository secret named AZURE_CREDENTIALS\n```\n\n\u003c/details\u003e\n\n## Development\n\n### Azure Resources\n\nDeployment of Azure resources for Azure Functions is based on the guide found [here](https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code) - converted to Bicep.\n\nTo develop with Bicep install the [necessary tooling](https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/install) (VS Code Extension, Bicep CLI).\n\nRemember to edit the [parameter file](./bicep/main.parameters.json) before deploying.\n\n### Functions\n\nTo develop the function, open the [function directory](./function-go) as a workspace in VS Code. This allows to use the Functions extensions to work on a local project.\n\nThis is based on the guide found [here](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-other?tabs=go%2Clinux). Remember to install the necessary tooling.\n\n#### Run function locally\n\nBuild the function:\n\n```bash\ncd function-go/src\ngo build -o main .\n```\n\nRun the function:\n\n```bash\n## Test the package and packaged function using Azure Functions Core Tools\ncd function-go\nfunc start                              # in one terminal\ncurl localhost:7071/api/hello?name=Mats # in another terminal\n\n## Alternatively run the binary without using Azure Functions Core Tools (to quickly test the go package)\ncd function-go\n./main                                  # in one terminal\ncurl localhost:8080/api/hello?name=Mats # in another terminal\n```\n\nNote that process running the binary will also log the requests with method, url, user agent and time to handle the request:\n\n```\n2021/11/10 23:04:43 About to listen on :8080. Go to https://127.0.0.1:8080/\n2021/11/10 23:04:47 GET /api/hello curl/7.68.0 7.7µs\n2021/11/10 23:08:08 GET /api/hello?name=Mats curl/7.68.0 38µs\n```\n\nFollow the [guide](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-other?tabs=go%2Clinux) for a more descriptive guide.\n\n#### Run the deployed function\n\n```bash\ncurl https://\u003cfunctionapp_name\u003e.azurewebsites.net/api/hello?name=Mats\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatsest%2Fazure-functions-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatsest%2Fazure-functions-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatsest%2Fazure-functions-demo/lists"}