Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
azure

GitHub Action

Azure Functions Action

v1.1.6

Azure Functions Action

azure

Azure Functions Action

Deploy Function App to Azure Functions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Azure Functions Action

uses: Azure/functions-action@v1.1.6

Learn more about this action in Azure/functions-action

Choose a version

GitHub Actions for deploying to Azure Functions

With the Azure Functions GitHub Action, you can automate your workflow to deploy Azure Functions.

Get started today with a free Azure account!

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

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

End-to-End Workflow

Workflow Templates

Templates Windows Linux
DotNet windows-dotnet-functionapp-on-azure.yml linux-dotnet-functionapp-on-azure.yml
Node windows-node.js-functionapp-on-azure.yml linux-node.js-functionapp-on-azure.yml
PowerShell windows-powershell-functionapp-on-azure.yml -
Java windows-java-functionapp-on-azure.yml linux-java-functionapp-on-azure.yml
Python - linux-python-functionapp-on-azure.yml

If you are have extension project(s) in your repo, these templates will NOT resolve the extensions.csproj in your project. If you want to use binding extensions (e.g. Blob/Queue/EventHub Triggers), please consider registering Azure Functions binding extensions in your host.json.

Alternatively, you can add a - run: dotnet build --output ./bin step before functions-action step.

Using Publish Profile as Deployment Credential (recommended)

You may want to get the publish profile from your function app. Using publish profile as deployemnt credential is recommended if you are not the owner of your Azure subscription.

  1. In Azure portal, go to your function app.
  2. Click Get publish profile and download .PublishSettings file.
  3. Open the .PublishSettings file and copy the content.
  4. Paste the XML content to your Github Repository > Settings > Secrets > Add a new secret > AZURE_FUNCTIONAPP_PUBLISH_PROFILE
  5. Use the above template to create the .github/workflows/your-workflow.yml file in your project repository.
  6. Change variable values in env: section according to your function app.
  7. Commit and push your project to GitHub repository, you should see a new GitHub workflow initiated in Actions tab.

Using Azure Service Principle for RBAC as Deployment Credential (deprecated)

You may want to create an Azure Service Principal for RBAC and add them 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. Copy and paste the json response from above Azure CLI to your Github Repository > Settings > Secrets > Add a new secret > AZURE_RBAC_CREDENTIALS
  2. Use Windows DotNet Function App RBAC template as a reference to build your workflow in .github/workflows/ directory.
  3. Change variable values in env: section according to your function app.
  4. Commit and push your project to GitHub repository, you should see a new GitHub workflow initiated in Actions tab.

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.
  • Environment setup actions
    • Setup DotNet Build your DotNet core function app or function app extensions.
    • Setup Node Resolve Node function app dependencies using npm.
    • Setup Python Resolve Python function app dependencies using pip.
    • Setup Java Resolve Java function app dependencies using maven.

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.