diff --git a/deployments/azure-functions-app-container.yml b/deployments/azure-functions-app-container.yml index 0984ba4..7b438be 100644 --- a/deployments/azure-functions-app-container.yml +++ b/deployments/azure-functions-app-container.yml @@ -1,17 +1,39 @@ -# Action Requires -# 1. Setup the AZURE_CREDENTIALS secrets in your GitHub Repository -# 2. Setup the REGISTRY_USERNAME secrets in your GitHub Repository -# 3. Setup the REGISTRY_PASSWORD secrets in your GitHub Repository -# 4. Replace REGISTRY, NAMESPACE, IMAGE, TAG in the following template with proper values -# 5. Add this yaml file to your project's .github/workflows/ -# 6. Push your local project to your GitHub Repository +# This workflow will build a container and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image?tabs=in-process%2Cbash%2Cazure-cli&pivots=programming-language-csharp +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_RBAC_CREDENTIALS +# - REGISTRY_USERNAME +# - REGISTRY_PASSWORD +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Container Action: https://github.com/Azure/functions-container-action +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp -name: Linux_Container_Workflow +name: Deploy container to Azure Functions App on: push: branches: - - master + - [$default-branch] + +permissions: + contents: read + +env: + AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure + LOGIN_SERVER: 'login-server' # set this to login server for your private container registry (e.g. 'contoso.azurecr.io', 'index.docker.io' ) + REGISTRY: 'your-registry' # set this to proper value for REGISTRY + NAMESPACE: 'your-namespace' # set this to proper value for NAMESPACE + IMAGE: 'your-image' # set this to proper value for IMAGE + TAG: 'your-tag' # set this to proper value for TAG jobs: build-and-deploy: @@ -24,12 +46,12 @@ jobs: - name: 'Login via Azure CLI' uses: azure/login@v1 with: - creds: ${{ secrets.AZURE_CREDENTIALS }} + creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} - name: 'Docker Login' uses: azure/docker-login@v1 with: - login-server: contoso.azurecr.io + login-server: ${{ env.LOGIN_SERVER }} username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} @@ -38,20 +60,21 @@ jobs: run: | # If your function app project is not located in your repository's root # Please change the path to your directory for docker build - docker build . -t REGISTRY/NAMESPACE/IMAGE:TAG - docker push REGISTRY/NAMESPACE/IMAGE:TAG + docker build . -t ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }} + docker push ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }} - name: 'Run Azure Functions Container Action' uses: Azure/functions-container-action@v1 id: fa with: - app-name: PLEASE_REPLACE_THIS_WITH_YOUR_FUNCTION_APP_NAME - image: REGISTRY/NAMESPACE/IMAGE:TAG + app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} + image: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }} - #- name: 'use the published functionapp url in upcoming steps' + # If you want to display or use the functionapp url, then uncomment the task below + #- name: 'Published functionapp url' # run: | # echo "${{ steps.fa.outputs.app-url }}" - name: Azure logout run: | - az logout \ No newline at end of file + az logout diff --git a/deployments/azure-functions-app-dotnet.yml b/deployments/azure-functions-app-dotnet.yml index 40f76ab..7f094eb 100644 --- a/deployments/azure-functions-app-dotnet.yml +++ b/deployments/azure-functions-app-dotnet.yml @@ -1,15 +1,28 @@ +# This workflow will build a .NET Core project and deploy it to an Azure Functions App on Windows or Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-csharp?tabs=in-process +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Action: https://github.com/Azure/functions-action +# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp + name: Deploy DotNet project to Azure Function App on: - [push] + push: + branches: + - [$default-branch] -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# 1. Set up the following secrets in your repository: -# AZURE_FUNCTIONAPP_PUBLISH_PROFILE -# -# 2. Change these variables for your configuration: env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root @@ -27,7 +40,7 @@ jobs: # - name: 'Login via Azure CLI' # uses: azure/login@v1 # with: - # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} + # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository - name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment uses: actions/setup-dotnet@v3 @@ -47,4 +60,5 @@ jobs: with: app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output' - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC \ No newline at end of file + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC + \ No newline at end of file diff --git a/deployments/azure-functions-app-java.yml b/deployments/azure-functions-app-java.yml index 138a877..a00db93 100644 --- a/deployments/azure-functions-app-java.yml +++ b/deployments/azure-functions-app-java.yml @@ -1,15 +1,28 @@ +# This workflow will build a Java project and deploy it to an Azure Functions App on Windows or Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-java +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Action: https://github.com/Azure/functions-action +# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp + name: Deploy Java project to Azure Function App on: - [push] + push: + branches: + - [$default-branch] -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# 1. Set up the following secrets in your repository: -# AZURE_FUNCTIONAPP_PUBLISH_PROFILE -# -# 2. Change these variables for your configuration: env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure POM_XML_DIRECTORY: '.' # set this to the directory which contains pom.xml file @@ -27,7 +40,7 @@ jobs: # - name: 'Login via Azure CLI' # uses: azure/login@v1 # with: - # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} + # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository - name: Setup Java Sdk ${{ env.JAVA_VERSION }} uses: actions/setup-java@v1 @@ -48,4 +61,5 @@ jobs: app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} package: '${{ env.POM_XML_DIRECTORY }}' # if there are multiple function apps in same project, then this path will be like './${{ env.POM_XML_DIRECTORY }}/target/azure-functions/${{ env.POM_FUNCTIONAPP_NAME }' publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC - respect-pom-xml: true \ No newline at end of file + respect-pom-xml: true + \ No newline at end of file diff --git a/deployments/azure-functions-app-nodejs.yml b/deployments/azure-functions-app-nodejs.yml index 4d7505d..5f17455 100644 --- a/deployments/azure-functions-app-nodejs.yml +++ b/deployments/azure-functions-app-nodejs.yml @@ -1,15 +1,30 @@ +# This workflow will build a Node.js project and deploy it to an Azure Functions App on Windows or Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see: +# - https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-node +# - https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Action: https://github.com/Azure/functions-action +# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp + name: Deploy Node.js project to Azure Function App on: - [push] + push: + branches: + - [$default-branch] -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# 1. Set up the following secrets in your repository: -# AZURE_FUNCTIONAPP_PUBLISH_PROFILE -# -# 2. Change these variables for your configuration: env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root @@ -27,7 +42,7 @@ jobs: # - name: 'Login via Azure CLI' # uses: azure/login@v1 # with: - # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} + # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository - name: Setup Node ${{ env.NODE_VERSION }} Environment uses: actions/setup-node@v3 @@ -49,4 +64,5 @@ jobs: with: app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC \ No newline at end of file + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC + \ No newline at end of file diff --git a/deployments/azure-functions-app-powershell.yml b/deployments/azure-functions-app-powershell.yml index d228efa..824b94e 100644 --- a/deployments/azure-functions-app-powershell.yml +++ b/deployments/azure-functions-app-powershell.yml @@ -1,15 +1,28 @@ +# This workflow will deploy a PowerShell project to an Azure Functions App on Windows or Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-powershell +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Action: https://github.com/Azure/functions-action +# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp + name: Deploy PowerShell project to Azure Function App on: - [push] + push: + branches: + - [$default-branch] -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# 1. Set up the following secrets in your repository: -# AZURE_FUNCTIONAPP_PUBLISH_PROFILE -# -# 2. Change these variables for your configuration: env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root @@ -26,7 +39,7 @@ jobs: # - name: 'Login via Azure CLI' # uses: azure/login@v1 # with: - # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} + # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository - name: 'Run Azure Functions Action' uses: Azure/functions-action@v1 @@ -34,4 +47,5 @@ jobs: with: app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC \ No newline at end of file + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC + \ No newline at end of file diff --git a/deployments/azure-functions-app-python.yml b/deployments/azure-functions-app-python.yml index 0964914..d387ba2 100644 --- a/deployments/azure-functions-app-python.yml +++ b/deployments/azure-functions-app-python.yml @@ -1,15 +1,28 @@ +# This workflow will build a Python app and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure Functions app. +# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python?pivots=python-mode-configuration +# +# To configure this workflow: +# 1. Set up the following secrets in your repository: +# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# 2. Change env variables for your configuration. +# +# For more information on: +# - GitHub Actions for Azure: https://github.com/Azure/Actions +# - Azure Functions Action: https://github.com/Azure/functions-action +# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended +# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential +# +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp + name: Deploy Python project to Azure Function App on: - [push] + push: + branches: + - [$default-branch] -# CONFIGURATION -# For help, go to https://github.com/Azure/Actions -# -# 1. Set up the following secrets in your repository: -# AZURE_FUNCTIONAPP_PUBLISH_PROFILE -# -# 2. Change these variables for your configuration: env: AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root @@ -27,7 +40,7 @@ jobs: # - name: 'Login via Azure CLI' # uses: azure/login@v1 # with: - # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} + # creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository - name: Setup Python ${{ env.PYTHON_VERSION }} Environment uses: actions/setup-python@v4 @@ -50,4 +63,5 @@ jobs: package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC scm-do-build-during-deployment: true - enable-oryx-build: true \ No newline at end of file + enable-oryx-build: true + \ No newline at end of file diff --git a/deployments/properties/azure-functions-app-dotnet.properties.json b/deployments/properties/azure-functions-app-dotnet.properties.json index 38e472c..8ae963d 100644 --- a/deployments/properties/azure-functions-app-dotnet.properties.json +++ b/deployments/properties/azure-functions-app-dotnet.properties.json @@ -3,5 +3,5 @@ "description": "Build a .NET Core project and deploy it to an Azure Functions App on Windows or Linux.", "creator": "Microsoft Azure", "iconName": "azure", - "categories": ["Deployment", "C#", "aspNetCore", "Azure Functions"] + "categories": ["Deployment", "C#", "AspNetCore", "Azure Functions"] } diff --git a/deployments/properties/azure-functions-app-powershell.properties.json b/deployments/properties/azure-functions-app-powershell.properties.json index bd6d80d..533f84f 100644 --- a/deployments/properties/azure-functions-app-powershell.properties.json +++ b/deployments/properties/azure-functions-app-powershell.properties.json @@ -1,6 +1,6 @@ { "name": "Deploy PowerShell app to Azure Functions App", - "description": "Deploy PowerShell project to an Azure Functions App on Windows or Linux.", + "description": "Deploy a PowerShell project to an Azure Functions App on Windows or Linux.", "creator": "Microsoft Azure", "iconName": "azure", "categories": ["Deployment", "PowerShell", "Azure Functions"]