215eacdc72 | ||
---|---|---|
.github | ||
eng/ci | ||
lib | ||
src | ||
.gitignore | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
action.yml | ||
jest.config.js | ||
package-lock.json | ||
package.json | ||
tsconfig.base.json | ||
tsconfig.dev.json | ||
tsconfig.prod.json |
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.
- Download Azure CLI from here, run
az login
to login with your Azure credentials. - 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>",
(...)
}
- Paste the json response from above Azure CLI to your GitHub Repository > Settings > Secrets > Add a new secret > AZURE_CREDENTIALS
Setup Container Registry Credentials
- Paste your container registry username (e.g. docker hub username) to your GitHub Repository > Settings > Secrets > Add a new secret > REGISTRY_USERNAME
- Paste your container registry password (e.g. docker hub password) to your GitHub Repository > Settings > Secrets > Add a new secret > REGISTRY_PASSWORD
- (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
- Follow the tutorial Create a function on Linux using a custom image
- Customize your Dockerfile to ensure the function app dependencies can be resolved properly on runtime (e.g. npm install)
- Use the linux-container-functionapp-on-azure.yml template as a reference, create a new workflow.yml file under your project
./github/workflows/
- 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.