|
2 | 2 | author: cephalin |
3 | 3 | ms.service: azure-app-service |
4 | 4 | ms.topic: include |
5 | | -ms.date: 11/18/2025 |
| 5 | +ms.date: 03/03/2026 |
6 | 6 | ms.author: cephalin |
7 | 7 | ms.custom: |
8 | 8 | - build-2025 |
9 | 9 | --- |
10 | 10 |
|
11 | 11 |
|
12 | | -In this section, you'll use GitHub Codespaces to create an Azure OpenAI resource with the Azure CLI. |
| 12 | +In this section, you use Azure CLI in GitHub Codespaces to create an Azure OpenAI resource. |
13 | 13 |
|
14 | | -1. Go to [GitHub Codespaces](https://github.com/codespaces) and sign in with your GitHub account. |
15 | | -1. Find the **Blank** template by GitHub and select **Use this template** to create a new blank Codespace. |
16 | | -1. In the Codespace terminal, install the Azure CLI: |
| 14 | +1. Sign in to [GitHub Codespaces](https://github.com/codespaces) with your GitHub account. |
| 15 | +1. Select **Use this template** in the **Blank** tile to create a new blank codespace. |
| 16 | +1. In the Codespace terminal, install the Azure CLI. |
17 | 17 |
|
18 | | - ```bash |
19 | | - curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
20 | | - ``` |
21 | | - |
22 | | -1. Sign in to your Azure account: |
| 18 | + ```bash |
| 19 | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
| 20 | + ``` |
23 | 21 |
|
24 | | - ```azurecli |
25 | | - az login |
26 | | - ``` |
27 | | - |
28 | | - Follow the instructions in the terminal to authenticate. |
| 22 | +1. Sign in to your Azure account. |
29 | 23 |
|
30 | | -1. Set environment variables for your resource group name, Azure OpenAI service name, and location: |
| 24 | + ```azurecli |
| 25 | + az login |
| 26 | + ``` |
31 | 27 |
|
32 | | - ```azurecli |
33 | | - export RESOURCE_GROUP="<group-name>" |
34 | | - export OPENAI_SERVICE_NAME="<azure-openai-name>" |
35 | | - export APPSERVICE_NAME="<app-name>" |
36 | | - export LOCATION="eastus2" |
37 | | - ``` |
| 28 | + Follow the instructions in the terminal to authenticate. |
38 | 29 |
|
39 | | - > [!IMPORTANT] |
40 | | - > The region is critical as it's tied to the regional availability of the chosen model. Model availability and [deployment type availability](/azure/ai-foundry/foundry-models/concepts/deployment-types) vary from region to region. This tutorial uses `gpt-4o-mini`, which is available in `eastus2` under the Standard deployment type. If you deploy to a different region, this model might not be available or might require a different tier. Before changing regions, consult the [Model summary table and region availability](/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability) to verify model support in your preferred region. |
41 | | - > |
| 30 | +1. Set environment variables by providing names for your resource group and Azure OpenAI service and setting an appropriate Azure region as your location. |
42 | 31 |
|
43 | | -1. Create a resource group and an Azure OpenAI resource with a custom domain, then add a gpt-4o-mini model: |
| 32 | + ```azurecli |
| 33 | + export RESOURCE_GROUP="<group-name>" |
| 34 | + export OPENAI_SERVICE_NAME="<azure-openai-name>" |
| 35 | + export APPSERVICE_NAME="<app-name>" |
| 36 | + export LOCATION="<azure-region>" |
| 37 | + ``` |
44 | 38 |
|
45 | | - ```azurecli |
46 | | - # Resource group |
47 | | - az group create --name $RESOURCE_GROUP --location $LOCATION |
48 | | - # Azure OpenAI resource |
49 | | - az cognitiveservices account create \ |
50 | | - --name $OPENAI_SERVICE_NAME \ |
51 | | - --resource-group $RESOURCE_GROUP \ |
52 | | - --location $LOCATION \ |
53 | | - --custom-domain $OPENAI_SERVICE_NAME \ |
54 | | - --kind OpenAI \ |
55 | | - --sku s0 |
56 | | - # gpt-4o-mini model |
57 | | - az cognitiveservices account deployment create \ |
58 | | - --name $OPENAI_SERVICE_NAME \ |
59 | | - --resource-group $RESOURCE_GROUP \ |
60 | | - --deployment-name gpt-4o-mini \ |
61 | | - --model-name gpt-4o-mini \ |
62 | | - --model-version 2024-07-18 \ |
63 | | - --model-format OpenAI \ |
64 | | - --sku-name Standard \ |
65 | | - --sku-capacity 1 |
66 | | - # Cognitive Services OpenAI User role that lets the signed in Azure user to read models from Azure OpenAI |
67 | | - az role assignment create \ |
68 | | - --assignee $(az ad signed-in-user show --query id -o tsv) \ |
69 | | - --role "Cognitive Services OpenAI User" \ |
70 | | - --scope /subscriptions/$(az account show --query id -o tsv)/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$OPENAI_SERVICE_NAME |
71 | | - ``` |
| 39 | + > [!IMPORTANT] |
| 40 | + > The location is tied to the regional availability of the chosen model. Model and [deployment type](/azure/ai-foundry/foundry-models/concepts/deployment-types) availability vary among Azure regions and billing tiers. This tutorial uses `gpt-4o-mini`, which is available in several regions under the Standard deployment type. |
| 41 | + > |
| 42 | + > Before selecting a location, consult the [Model summary and region availability table](/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability) to verify model support in your preferred region. |
72 | 43 |
|
73 | | -Now that you have an Azure OpenAI resource, you'll create a web application to interact with it. |
| 44 | +1. Create a resource group and an Azure OpenAI resource with a custom domain, and then add a `gpt-4o-mini` model: |
| 45 | + |
| 46 | + ```azurecli |
| 47 | + # Resource group |
| 48 | + az group create --name $RESOURCE_GROUP --location $LOCATION |
| 49 | + # Azure OpenAI resource |
| 50 | + az cognitiveservices account create \ |
| 51 | + --name $OPENAI_SERVICE_NAME \ |
| 52 | + --resource-group $RESOURCE_GROUP \ |
| 53 | + --location $LOCATION \ |
| 54 | + --custom-domain $OPENAI_SERVICE_NAME \ |
| 55 | + --kind OpenAI \ |
| 56 | + --sku s0 |
| 57 | + # gpt-4o-mini model |
| 58 | + az cognitiveservices account deployment create \ |
| 59 | + --name $OPENAI_SERVICE_NAME \ |
| 60 | + --resource-group $RESOURCE_GROUP \ |
| 61 | + --deployment-name gpt-4o-mini \ |
| 62 | + --model-name gpt-4o-mini \ |
| 63 | + --model-version 2024-07-18 \ |
| 64 | + --model-format OpenAI \ |
| 65 | + --sku-name Standard \ |
| 66 | + --sku-capacity 1 |
| 67 | + # Cognitive Services OpenAI User role that lets the signed in Azure user read models from Azure OpenAI |
| 68 | + az role assignment create \ |
| 69 | + --assignee $(az ad signed-in-user show --query id -o tsv) \ |
| 70 | + --role "Cognitive Services OpenAI User" \ |
| 71 | + --scope /subscriptions/$(az account show --query id -o tsv)/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.CognitiveServices/accounts/$OPENAI_SERVICE_NAME |
| 72 | + ``` |
| 73 | + |
| 74 | +Now that you have an Azure OpenAI resource, you can create a web application to interact with it. |
0 commit comments