This guide explains how to create the Azure resources and model deployment used by CONNX Demo. Microsoft changes portal labels periodically, so consult the linked Microsoft documentation if the current portal differs slightly.
- An Azure account with an active subscription.
- Permission to create or use a Microsoft Foundry resource and deploy models.
- Permission to read the resource endpoint and an API key.
- A region where the required OpenAI model is available and permitted by your organization.
See Microsoft's current Foundry resource quickstart for resource and role requirements.
- Sign in to the Microsoft Foundry portal.
- Create a project, or open an existing project owned by your organization.
- When creating a project, select the correct subscription, resource group, resource name, and region.
- Wait for the project and its associated Foundry resource to finish provisioning.
If your organization manages Azure resources centrally, ask which existing Foundry or Azure OpenAI resource to use. Do not create a duplicate resource only to obtain another deployment.
- In the project, open Models + endpoints.
- Choose Deploy model. The portal may first direct you to the model catalog.
- Select an OpenAI chat model available to your subscription and region.
- Review the deployment type, model version, capacity or quota, and content filtering options available to your organization.
- Enter a deployment name and create the deployment.
- Wait until the deployment reports a ready or successful state.
Azure API requests use the deployment name, which can differ from the underlying model name. Microsoft explains deployments in its Foundry endpoint documentation.
For example, if a model is deployed as 'gpt-5.4-mini', configure:
AZURE_OPENAI_DEPLOYMENT=gpt-5.4-miniDo not enter the model catalog name unless it is also the deployment name you created.
Open the deployment or its associated Azure resource and locate its endpoint and keys. Depending on the current portal, these may appear under Models + endpoints, Endpoint, or Keys and Endpoint.
You need these values:
| Application setting | Azure value |
|---|---|
AZURE_OPENAI_ENDPOINT |
Azure OpenAI resource base endpoint |
AZURE_OPENAI_API_KEY |
API key belonging to that resource |
AZURE_OPENAI_DEPLOYMENT |
Deployment name created above |
For this application, use the Azure OpenAI base resource endpoint, such as:
https://your-resource-name.openai.azure.com/
Some newer Foundry resources display a base endpoint under
services.ai.azure.com. Use the endpoint shown for the deployment's Azure
OpenAI API, not a project-management URL or playground URL.
Do not include /chat/completions or /deployments/<name> in
AZURE_OPENAI_ENDPOINT; the OpenAI SDK adds the API route. Microsoft lists
supported endpoint forms in the
Azure OpenAI API reference.
Treat the API key as a secret. Never put it in source code, documentation, screenshots, issues, or Git commits.
From the project directory, create .env if needed:
Copy-Item .env.example .envSet the Azure values:
AZURE_OPENAI_API_KEY=your-actual-resource-key
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT=your-deployment-name
AZURE_OPENAI_API_VERSION=2024-02-15-preview
AZURE_OPENAI_MAX_COMPLETION_TOKENS=500Keep .env local. It is ignored by this repository and must never be added
forcibly to Git.
The API version above is the version currently configured by this project. Only change it when intentionally testing an API version supported by both the Azure deployment and installed OpenAI SDK.
Before testing this application, open the deployment's chat playground:
- Select the deployment.
- Enter a short prompt.
- Confirm the deployment returns a response.
This isolates Azure provisioning, quota, and content-filtering issues from the application and database configuration.
-
Complete the database and
SECRET_KEYsettings in README.md. -
Start the application:
python app.py
-
Open
http://localhost:4999. -
Submit:
Show a list of employees that own GREEN coloured vehicles.
A successful result confirms that the deployment name, endpoint, key, API version, network access, and database configuration work together.
- Confirm the model is available in the resource's region.
- Check subscription quota and deployment capacity.
- Confirm you have permission to create deployments.
- Follow your organization's approval process if Azure requires registration or administrative approval.
- Spell every
AZURE_OPENAI_*variable exactly as shown. - Replace every placeholder copied from
.env.example. - Restart Flask after editing
.env.
- Use the deployment name, not merely the catalog model name.
- Confirm the endpoint and deployment belong to the same Azure resource.
- Use only the base endpoint in
AZURE_OPENAI_ENDPOINT. - Confirm the configured API version is accepted by the deployment.
- Confirm the API key belongs to the same resource as the endpoint.
- Rotate the key if it may have been exposed.
- Check whether local key authentication is disabled. This application currently expects API-key authentication, not Microsoft Entra ID.
- Verify the endpoint hostname resolves from the machine running Flask.
- Check proxy, firewall, private endpoint, and virtual-network rules.
- For a private endpoint, use an approved network with the required private DNS configuration.
- Use a deployment name that identifies the application and environment.
- Choose quota and capacity appropriate for a demo workload.
- Configure budgets or cost alerts according to organizational policy.
- Restrict resource access to users and applications that need it.
- Rotate keys exposed in logs, chat, screenshots, or Git.
- Never commit
.env.