Create a service principal in Azure Entra ID:
# Login to Azure
az login
# Create service principal and use output
az ad sp create-for-rbac --name "your-sp-name" --role contributor \
--scopes /subscriptions/your-subscription-id \
--sdk-auth
# These credentials are used as Github environment secrets to access Azure resources and services from Github workflows.
# **DO NOT** store or save them anywhere locally or in the repository
The output should look like:
{
"clientId": "xxx",
"clientSecret": "xxxx",
"subscriptionId": "xxxx",
"tenantId": "xxxx"
}
Create the following environments in your GitHub repository:
For each environment, set these variables (based on your .env file):
# Required for all environments
AZURE_CREDENTIALS: |
{
"clientId": "xxx",
"clientSecret": "xxxx",
"subscriptionId": "xxxx",
"tenantId": "xxxx"
}
# OpenAI Configuration
AZURE_OPENAI_API_VERSION: "2024-02-01"
AZURE_AI_CHAT_ENDPOINT: "https://your-instance.openai.azure.com/"
AZURE_AI_CHAT_KEY: "your-chat-key"
AOAI_API_KEY: "your-api-key"
GPT4O_DEPLOYMENT_NAME: "your-deployment"
GPT4O_API_KEY: "your-gpt4-key"
# Project Configuration
SUBSCRIPTION_ID: "your-subscription"
RESOURCE_GROUP_NAME: "your-resource-group"
PROJECT_NAME: "your-project-name"
USER_CLIENT_ID: "your-client-id"
CONNECTION_STRING: "your-connection-string"
PROMPTY_FILE: "prompty.yaml"
### Additional configuration for Semantic Kernel agent with AI Foundry
AZURE_AI_AGENT_PROJECT_CONNECTION_STRING: "your-connection-string"
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME: your-deployment-name
AZURE_AI_AGENT_ENDPOINT: https://xxxdomain.openai.azure.com/
AZURE_AI_AGENT_SUBSCRIPTION_ID: your-subscription-id
AZURE_AI_AGENT_RESOURCE_GROUP_NAME: your-resource-group
AZURE_AI_AGENT_PROJECT_NAME: your-project-name
NOTE: AZURE_AI_AGENT_ENDPOINT value is available from Azure AI Foundry Overview page under Endpoints and keys section associated with Azure OpenAI Service key
Triggers on PR to dev or main for specific changes:
name: Math Coding PR Workflow
on:
pull_request:
branches: [ main, dev ]
paths:
- 'math_coding/**'
- '.github/**'
- 'llmops/**'
jobs:
validate:
uses: ./.github/workflows/platform_pr_dev_workflow.yaml
with:
config-file: experiment.pr.yaml
secrets: inherit
Executes on PR merge to main or dev:
name: Math Coding CI/CD Workflow
on:
push:
branches: [ main, dev ]
paths:
- 'math_coding/**'
- '.github/**'
- 'llmops/**'
jobs:
evaluate:
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@v2
- name: Run Evaluation
run: |
python -m experiment.run --config experiment.dev.yaml
- name: Deploy Function
uses: ./.github/workflows/platform_cd_function_deployment.yaml
with:
config-file: experiment.dev.yaml
secrets: inherit
To trigger the PR workflow:
# Create and checkout feature branch
git checkout -b feature/math-enhancement
# Make changes to relevant files
# Example: Update math_coding/flows/math_code_generation/pure_python_flow.py
# Commit and push changes
git add .
git commit -m "Enhanced math coding functionality"
git push origin feature/math-enhancement
# Create PR to dev branch through GitHub interface