Open DaveBurnisonMS opened 10 months ago
To build and deploy this solution to Azure API Management using GitHub Actions, you need to follow these steps:
Here is a sample GitHub Actions workflow file that you can use as a starting point:
name: Build and Deploy to Azure API Management
on:
push:
branches:
- main # Trigger this workflow on push to the main branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure API Management
run: |
az apim create --name MyApiManagementService --resource-group MyResourceGroup --location WestUS --publisher-email email@example.com --publisher-name Contoso
az apim import --name MyApiManagementService --resource-group MyResourceGroup --path '/api' --specification-format OpenApiJson --specification-url https://myapi.example.com/openapi.json
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
Replace MyApiManagementService
, MyResourceGroup
, email@example.com
, Contoso
, and https://myapi.example.com/openapi.json
with your actual values.
This workflow file does the following:
Please note that you need to replace the placeholders in the az apim create
and az apim import
commands with your actual values. Also, you need to store your Azure service principal credentials as secrets in your GitHub repository.
Requires issue #2 to be complete !
Create a GitHub Actions workflow to automate the process of deploying this application to Azure Web Apps using a containerized workflow. This process will require setting up a container registry on Azure and creating an Azure Service Principal that has enough permissions for the deployment to initiate from the GitHub Action.
The Service Principal process creates a JSON blob that needs to be stored as a secret to be used within the GitHub Action.