Enable GitHub developers to deploy to Azure Function Apps Containers using GitHub Actions
Перейти к файлу
Kirstyn Amperiadis 215eacdc72
Use public pools for public build (#56)
2024-07-01 09:19:50 -05:00
.github Add official build yml files (#54) 2024-06-24 16:17:19 -05:00
eng/ci Use public pools for public build (#56) 2024-07-01 09:19:50 -05:00
lib update to node20 2024-05-29 15:27:57 -05:00
src update to node20 2024-05-29 15:27:57 -05:00
.gitignore L0 tests added 2020-03-17 14:12:38 +05:30
CODE_OF_CONDUCT.md functions-container-action v1 release 2019-09-18 23:28:53 -07:00
LICENSE functions-container-action v1 release 2019-09-18 23:28:53 -07:00
README.md Update README.md 2021-08-09 14:02:59 +05:30
SECURITY.md functions-container-action v1 release 2019-09-18 23:28:53 -07:00
action.yml update to node20 2024-05-29 15:27:57 -05:00
jest.config.js L0 tests added 2020-03-17 14:12:38 +05:30
package-lock.json update to node20 2024-05-29 15:27:57 -05:00
package.json update to node20 2024-05-29 15:27:57 -05:00
tsconfig.base.json functions-container-action v1 release 2019-09-18 23:28:53 -07:00
tsconfig.dev.json functions-container-action v1 release 2019-09-18 23:28:53 -07:00
tsconfig.prod.json functions-container-action v1 release 2019-09-18 23:28:53 -07:00

README.md

GitHub Actions for deploying customized Azure Functions image

With the Azure Functions GitHub Action, you can automate your workflow to deploy Azure Functions in a customized image.

Get started today with a free Azure account!

The repository contains a GitHub Action to deploy your customized function app image into Azure Functions. If you are looking for a simple GitHub Action to deploy your function app without building a customized image, please consider using functions-action.

The definition of this GitHub Action is in action.yml.

End-to-End Sample workflow

Dependencies on other GitHub Actions

  • Checkout Checkout your Git repository content into GitHub Actions agent.
  • Azure Login Login with your Azure credentials for function app deployment authentication.

Azure Service Principle for RBAC

Create an Azure Service Principal for RBAC and add it as a GitHub Secret in your repository.

  1. Download Azure CLI from here, run az login to login with your Azure credentials.
  2. Run Azure CLI command
   az ad sp create-for-rbac --name "myApp" --role contributor \
                            --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Web/sites/{app-name} \
                            --sdk-auth

  # Replace {subscription-id}, {resource-group}, and {app-name} with the names of your subscription, resource group, and Azure function app.
  # The command should output a JSON object similar to this:

  {
    "clientId": "<GUID>",
    "clientSecret": "<GUID>",
    "subscriptionId": "<GUID>",
    "tenantId": "<GUID>",
    (...)
  }
  1. Paste the json response from above Azure CLI to your GitHub Repository > Settings > Secrets > Add a new secret > AZURE_CREDENTIALS

Setup Container Registry Credentials

  1. Paste your container registry username (e.g. docker hub username) to your GitHub Repository > Settings > Secrets > Add a new secret > REGISTRY_USERNAME
  2. Paste your container registry password (e.g. docker hub password) to your GitHub Repository > Settings > Secrets > Add a new secret > REGISTRY_PASSWORD
  3. (Optional) Create a new repository under your registry namespace (e.g. docker.io/mynamespace/myrepository)

Create Azure function app and Deploy to function app container using GitHub Actions

  1. Follow the tutorial Create a function on Linux using a custom image
  2. Customize your Dockerfile to ensure the function app dependencies can be resolved properly on runtime (e.g. npm install)
  3. Use the linux-container-functionapp-on-azure.yml template as a reference, create a new workflow.yml file under your project ./github/workflows/
  4. Commit and push your project to GitHub repository, you should see a new GitHub Action initiated in Actions tab.

Azure Functions Action for deploying customized Azure Functions image is supported for the Azure public cloud as well as Azure government clouds ('AzureUSGovernment' or 'AzureChinaCloud'). Before running this action, login to the respective Azure Cloud using Azure Login by setting appropriate value for the environment parameter.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.