Skip to content

Latest commit

 

History

History
 
 

APIM DevOps Workflow

Deployment via CLI/Terminal

# COPY PARAMETERS TO LOCAL FILE
# FILL IN UNSPECIFIED PARAMS
cp main.parameters.json local.parameters.json

# SPECIFY LOCATION FOR DEPLOYMENT (USED FOR METADATA, NOT LOCATION FOR APIM DEPLOYMENT)
export LOCATION=eastus

# DEPLOY
az deployment sub create \
    --location $LOCATION \
    --name apim-deployment-`date +"%Y-%m-%d-%s"` \
    --template-file main.bicep \
    --parameters local.parameters.json \
    --confirm-with-what-if #if you want to see changes before confirming deployment

Deployment via GitHub Actions

  1. Setup your Environments

    • Create the Dev Environment
    • Create the Staging Environment
    • Create the Production Environment
  2. Define the Service Principal

    # CREATE SERVICE PRINCIPAL FOR WORKFLOW
    # THIS WILL BE USED AS A GITHUB ACTIONS SECRET
    # BY DEFAULT WILL HAVE CONTRIBUTOR ON SUBSCRIPTION
    az ad sp create-for-rbac \
    --name BicepGitHubActionsSP \
    --role Contributor \
    --sdk-auth
  3. Create a GitHub Secret named AZURE_CREDENTIALS

  4. Run Workflow

Initial Instantiation of APIM Instance

Portal Initialization

  1. First you can seed your portal-content folder by capturing the content from an experimental APIM instance where you customized and updated the portal:

    cd api-management-developer-portal
    npm install
    
    cd scripts.v3
    node ./capture \
    --subscriptionId <SUB_ID_OF_DEV_APIM> \
    --resourceGroupName <RG_NAME> \
    --service-name <APIM_NAME> \
    --folder ../../portal-content

    Moving forward you can now commit your portal content as an artifact you maintain like your other code and configuration for APIM

  2. You can run manually the generateAndPublish.js script if you want to now publish this content to a specific APIM instance:

    cd api-management-developer-portal
    npm install
    
    cd scripts.v3
    node ./generateAndPublish.js \
    --subscriptionId <SUB_ID_OF_TARGET_APIM> \
    --resourceGroupName <RG_NAME> \
    --service-name <APIM_NAME> \
    --folder ../../portal-content

    Note that the portal-content folder should have a media folder as well even if there are no contents in the media folder

References