Skip to main content
This guide shows two common ways to create an Azure OpenAI resource:
  • Portal deployment — a guided, beginner-friendly UI flow.
  • CLI deployment — scriptable and repeatable for automation and CI/CD.
Both approaches provision an Azure Cognitive Services account of kind OpenAI (often referred to as an Azure OpenAI resource). After provisioning you’ll obtain the resource endpoint and keys to call the Azure OpenAI APIs or connect the resource to Azure AI Foundry (Azure AI Studio).

Quick comparison

Deployment methodBest forProsCons
Portal (UI)Beginners, one-off setupsGuided validation, visual configuration, easy access to AI Studio linksManual steps, less repeatable
CLI / PowerShellAutomation, CI/CD, reproducible infraScriptable, repeatable, integrates with pipelinesRequires CLI authentication and scripting knowledge

Portal deployment (guided)

Steps — high level:
  1. Open the Azure portal: https://portal.azure.com
  2. Select your Subscription.
  3. Choose or create a Resource Group.
  4. Provide instance details: Resource name, Region, and Pricing tier.
  5. Complete validation and create the resource.
This guided workflow validates required fields as you fill them, making it ideal for first-time users.
A slide titled "Deploying an Azure OpenAI Resource" that outlines portal deployment steps. It shows Step 1: "Open Azure Portal" and Step 2: "Select Subscription," "Select Resource Group," and "Select Instance Details," with a "Portal Deployment" panel and an icon.

Creating a resource in the portal — example flow

When you create a resource you’ll typically:
  • Choose (or create) a resource group, e.g., rg-ai102-oai-eus.
  • Provide a resource name, e.g., ai102-aoai-eus.
  • Select a region (for example, East US) and choose the Pricing tier (commonly S0).
If required fields are missing, the portal surfaces validation errors that you must resolve before creating the resource.
A screenshot of an Azure service creation form showing Project Details and Instance Details — Subscription "Kodekloud Labs", Resource group "(New) rg-ai102-oai-eus", Region set to "East US" and a partially entered Name. The Pricing tier field is empty and highlighted with a validation error reading "The value must not be empty."
After clicking Create:
  • Deployment may take several minutes.
  • When complete, click Go to resource.
  • From the resource overview you can copy the keys and endpoint, and open Azure AI Foundry / AI Studio for model experiments and deployments.
Example resource endpoint (found on the resource overview):
https://ai102-aoai-eus.openai.azure.com/

CLI deployment (automated)

Use Azure CLI or Azure PowerShell when you need automation or pipeline integration. Before creating resources, sign in and ensure the correct subscription is selected:
# Sign in interactively
az login

# (Optional) Set the subscription to use
az account set --subscription "YourSubscriptionID"
Create an Azure OpenAI (Cognitive Services) resource using Azure CLI:
az cognitiveservices account create \
  --name YourAIResource \
  --resource-group YourResourceGroup \
  --location eastus \
  --kind OpenAI \
  --sku S0 \
  --subscription YourSubscriptionID
Notes:
  • Use uppercase S0 for the --sku value in most cases.
  • This command provisions a Cognitive Services account with kind set to OpenAI. After provisioning, retrieve keys and the endpoint from the resource overview.
Before creating an Azure OpenAI resource, ensure your account and subscription have the required permissions and quota. Some tenants require an access request or enrollment for Azure OpenAI—check your organization’s policy and request access if needed.

Post-deployment: keys, endpoints, and Azure AI Foundry

Common use cases for Azure OpenAI models:
  • Generate or summarize text
  • Answer natural-language questions
  • Assist with code generation or translation
  • Integrate securely in enterprise Azure architectures

Troubleshooting tips

  • If the portal shows validation errors, verify all required fields (Subscription, Resource Group, Region, Pricing tier).
  • If CLI returns permission or quota errors, confirm subscription and role access, and check if Azure OpenAI access must be requested for your tenant.
  • Confirm correct region availability for Azure OpenAI in your subscription.

Watch Video