Introduction
OpenAI’s Codex CLI is the same coding agent that powers ChatGPT’s Codex. You can now run this coding agent entirely on Azure infrastructure, which keeps your data inside your compliance boundary and gives you the advantages of enterprise‑grade security, private networking, role‑based access control, and predictable cost management. Codex is more than a chat with your code agent – it is an asynchronous coding agent that can be triggered from your terminal or from a GitHub Actions runner, automatically opening pull requests, refactoring files, and writing tests with the credentials of your Azure OpenAI deployment. Explore deploying it with Azure OpenAI for use cases such as language translation, data‑to‑code, and legacy migration as detailed in the original Introducing Codex blog post.
After you are up and running, visit gitagu.com to configure your repository for Codex and to browse a growing catalog of other Azure‑hosted coding agents, including GitHub Copilot Coding Agent, Cognition Devin, SRE Agent, and more.
Prerequisites
- An active Azure subscription with access to Azure OpenAI.
- Contributor permissions in Azure AI Foundry.
- macOS, Linux, or Windows 11 plus WSL 2 (Codex is trained on Unix‑style shells).
- Node 18+ and
npm
for installing the CLI.
Step 1 – Deploy a Codex model in Azure AI Foundry
- Go to
ai.azure.com
and create a new project. - Select a reasoning model such as
codex-mini
,o4-mini
, oro3
. - Click Deploy, choose a name, and wait about two minutes.
- Copy the Endpoint URL and generate an API key.
Step 2 – Install the Codex CLI
npm install -g @openai/codex
codex --version # verify installation
Step 3 – Configure ~/.codex/config.json
{
"model": "codex-mini",
"provider": "azure",
"providers": {
"azure": {
"name": "AzureOpenAI",
"baseURL": "https://<your-resource>.openai.azure.com/openai",
"envKey": "AZURE_OPENAI_API_KEY"
}
},
"history": {
"maxSize": 1000,
"saveHistory": true,
"sensitivePatterns": []
}
}
# Linux, macOS, or WSL
export AZURE_OPENAI_API_KEY="<your-api-key>"
Step 4 – Explore with your coding agent
codex -p azure
# generate a unit test for src/utils/date.ts
# convert this Java class to Python
Step 5 – Run Codex in GitHub Actions
Codex can execute as part of your CI pipeline. Store your API key in the
repository’s secret store as AZURE_OPENAI_API_KEY
and add a job like:
jobs:
codex_refactor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Codex agent
run: |
npm install -g @openai/codex
export AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}
codex -p azure "# refactor the authentication module for clarity"
Step 6 – Explore more agents with Gitagu
- Browse detailed docs and benchmarks for other Azure‑hosted agents.
- Create repo‑ready configuration guides with one click.
- Experiment with GitHub Copilot Coding Agent, Cognition Devin, SRE Agent, and others.
Troubleshooting
Symptom | Fix |
---|---|
401 Unauthorized |
Ensure AZURE_OPENAI_API_KEY is exported in the current shell or set as a GitHub secret. |
ENOTFOUND or DNS error |
Verify the baseURL is correct and ends in /openai . |
Conclusion
In just a few minutes you can connect an AI coding agent to your Azure tenant, keep intellectual property secure, and accelerate software delivery. Combine Codex CLI, GitHub Actions, and Gitagu’s agent catalog to build a flexible AI‑powered engineering workflow. Give it a try and share what you create.
Questions or feedback? Drop a comment below
0 comments
Be the first to start the discussion.