> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploying an Azure OpenAI Resource

> Guide for creating and managing an Azure OpenAI resource via the Azure portal or CLI, including post deployment keys, endpoints, and troubleshooting

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 method | Best for                              | Pros                                                                    | Cons                                                |
| ----------------- | ------------------------------------- | ----------------------------------------------------------------------- | --------------------------------------------------- |
| Portal (UI)       | Beginners, one-off setups             | Guided validation, visual configuration, easy access to AI Studio links | Manual steps, less repeatable                       |
| CLI / PowerShell  | Automation, CI/CD, reproducible infra | Scriptable, repeatable, integrates with pipelines                       | Requires CLI authentication and scripting knowledge |

## Portal deployment (guided)

Steps — high level:

1. Open the Azure portal: [https://portal.azure.com](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.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/MVK09m96KxI8SuM5/images/AI-102-Microsoft-Certified-Azure-AI-Engineer-Associate/Get-Started-with-Azure-OpenAI-Service/Deploying-an-Azure-OpenAI-Resource/azure-openai-portal-deployment-steps.jpg?fit=max&auto=format&n=MVK09m96KxI8SuM5&q=85&s=3b2bc2c1e1495f58ab08363eb76ad76d" alt="A slide titled &#x22;Deploying an Azure OpenAI Resource&#x22; that outlines portal deployment steps. It shows Step 1: &#x22;Open Azure Portal&#x22; and Step 2: &#x22;Select Subscription,&#x22; &#x22;Select Resource Group,&#x22; and &#x22;Select Instance Details,&#x22; with a &#x22;Portal Deployment&#x22; panel and an icon." width="1920" height="1080" data-path="images/AI-102-Microsoft-Certified-Azure-AI-Engineer-Associate/Get-Started-with-Azure-OpenAI-Service/Deploying-an-Azure-OpenAI-Resource/azure-openai-portal-deployment-steps.jpg" />
</Frame>

### 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.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/MVK09m96KxI8SuM5/images/AI-102-Microsoft-Certified-Azure-AI-Engineer-Associate/Get-Started-with-Azure-OpenAI-Service/Deploying-an-Azure-OpenAI-Resource/azure-service-creation-pricing-tier-error.jpg?fit=max&auto=format&n=MVK09m96KxI8SuM5&q=85&s=b932f2cf4acec4d203f5c4d88ed252ff" alt="A screenshot of an Azure service creation form showing Project Details and Instance Details — Subscription &#x22;Kodekloud Labs&#x22;, Resource group &#x22;(New) rg-ai102-oai-eus&#x22;, Region set to &#x22;East US&#x22; and a partially entered Name. The Pricing tier field is empty and highlighted with a validation error reading &#x22;The value must not be empty.&#x22;" width="1920" height="1080" data-path="images/AI-102-Microsoft-Certified-Azure-AI-Engineer-Associate/Get-Started-with-Azure-OpenAI-Service/Deploying-an-Azure-OpenAI-Resource/azure-service-creation-pricing-tier-error.jpg" />
</Frame>

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):

```text theme={null}
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:

```bash theme={null}
# 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:

```bash theme={null}
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.

<Callout icon="lightbulb" color="#1CB2FE">
  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.
</Callout>

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

* From the resource overview you can:
  * View and copy your endpoint and keys.
  * Navigate to Azure AI Foundry (Azure AI Studio) for model experimentation and deployment.
* Use the endpoint and keys to authenticate and call the Azure OpenAI APIs:
  * Overview and API reference: [https://learn.microsoft.com/azure/cognitive-services/openai/overview](https://learn.microsoft.com/azure/cognitive-services/openai/overview)
  * Azure AI Studio: [https://learn.microsoft.com/azure/ai-studio/](https://learn.microsoft.com/azure/ai-studio/)

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.

## Links and references

* [Azure Portal](https://portal.azure.com)
* [Azure CLI documentation](https://learn.microsoft.com/cli/azure/)
* [Azure PowerShell](https://learn.microsoft.com/powershell/azure/)
* [Azure OpenAI overview and API docs](https://learn.microsoft.com/azure/cognitive-services/openai/overview)
* [Azure AI Studio (Foundry)](https://learn.microsoft.com/azure/ai-studio/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/ai-102-microsoft-certified-azure-ai-engineer-associate/module/f28c5dfe-9fe8-486d-bc61-eade55096b1c/lesson/8bc24781-db55-408e-bf85-75aa2f948864" />
</CardGroup>
