Azure OpenAI in southafricanorth is the only managed path to in-country LLM inference in South Africa from a major vendor — and it's narrow: Regional PTU for gpt-4o (2024-05-13) only, a version scheduled to retire on 9 December 2026. Current GPT models in Johannesburg run as Global deployments, which process prompts outside the country. AWS Bedrock's af-south-1 and Google Vertex AI's africa-south1 don't run their frontier models in country either. For regulated workloads that have to keep prompts and grounding data in country — banking, healthcare, public sector, FAIS-covered advisory — check where LLM inference actually runs before committing to a pattern. This sub-tree maps the strategy decision (which Copilot surface fits the workload), the implementation patterns (how a Worker actually calls gpt-4o in Joburg), and the auth model that holds it all together.
Six live nodes today: the strategy-level explainer for the in-country LLM decision, the implementation node for the headless Worker pattern, the AI Gateway upgrade that wraps it with observability, the Copilot Studio playbook on treating agents as software, the Dataverse platform node beneath them all, and a build-or-buy guide to owning your survey platform on .NET and Azure. Two more in the pipeline — the Azure AI Agent Service alternative for full-code agents, and the M365 Copilot deep dive on the SA M365 Geo.
The in-country LLM decision tree. Six Copilot surfaces, three viable patterns, a comparison against Anthropic / OpenAI / Bedrock, and the use-case grid for banking, public sector, healthcare, and FAIS advisory.
Build 2026: Microsoft's seven in-house MAI frontier models and the humanist-superintelligence strategy — efficiency, RLEs, Maia 200 silicon, clean data lineage, the open anchors, and the POPIA / SA data-residency note. Lives in the agents Models band.
The headless pattern — a JNB-colocated Worker calling gpt-4o in southafricanorth. Four production-grade concepts: api-key fetch, SSE streaming, throttle handling with KV idempotency, and Entra ID OAuth client credentials.
The observability and resilience upgrade. One URL change buys cache, retry, prompt logs, cost dashboards, and per-tenant rate limits — for ~5 ms latency overhead. The default for any LLM workload heading to production.
The full-code escape hatch when Copilot Studio's low-code ceiling isn't enough. Threads, tool calls, file search, code interpreter — orchestrated against the same SA-North gpt-4o substrate.
Tenant-Geo verification, the surfaces that leak data out of country (Bing grounding, plugins, Loop, Whiteboard), Purview controls, and the audit log path for a POPIA-defensible "where does my data go" answer.
A Copilot Studio agent is a Dataverse solution component — so it's software, and needs ALM. Dev/test/prod, managed vs unmanaged, the components that silently don't survive export, and putting an agent under version control.
Azure OpenAI, Microsoft Graph, Power Platform, and Copilot Studio all share the same identity layer: Entra ID (formerly Azure AD). Learn the OAuth client-credentials flow once and it works for every API in this branch. Two scopes cover almost everything an integration needs.
Register an app in Entra ID, generate a client secret, request a token from login.microsoftonline.com with the scope for the API you want. Tokens are 60-minute by default — cache them in KV with a 55-minute TTL and rotate the secret in Key Vault without touching code.
// Two scopes cover the whole Microsoft surface const aiScope = 'https://cognitiveservices.azure.com/.default'; // Azure OpenAI const graphScope = 'https://graph.microsoft.com/.default'; // M365 / Copilot // Same flow, different scope const body = new URLSearchParams({ client_id: env.AZURE_CLIENT_ID, client_secret: env.AZURE_CLIENT_SECRET, scope: aiScope, // or graphScope grant_type: 'client_credentials', });
The payoff: every leaf in this hub uses the same auth function. The Worker that calls Azure OpenAI is one scope away from being the Worker that reads a user's mailbox. See concept 04 in the Workers explainer for the production-grade KV-cached implementation.
Three different residency commitments, three different boundaries. Azure OpenAI in southafricanorth keeps inference in country only on Regional PTU deployments — and currently only for gpt-4o 2024-05-13, which is scheduled to retire on 9 Dec 2026. The default Global Standard SKU keeps data at rest in country but processes prompts and completions in any Microsoft Foundry region globally. The strict-residency path is Regional PTU; the pragmatic path is Global Standard with the M365 Geo data-at-rest commitment. Confirm specific model availability with Microsoft before architectural decisions — regional Standard in SA North currently covers embedding models only. M365 Copilot with the SA M365 Geo stores prompts, completions, and grounding data at rest in country; LLM compute uses the global Azure OpenAI pool. Copilot Studio with BYO model inherits whatever residency the BYO model offers — strict in country if the BYO is a Regional PTU AOAI deployment, hybrid otherwise.
The strict reading (bank offshoring rules, certain DPSA mandates) requires the AOAI guarantee. The pragmatic reading (most POPIA s.72 cases) accepts the M365 Geo guarantee. The decision is in the strategy explainer — implementation lives in the patterns explainer.
Microsoft is the LLM substrate. Cloudflare is the runtime that calls it. ERP / CRM systems are what the agents talk to. The legal branch is the constraint layer. Every Microsoft leaf depends on all four.