Skip to content

Commit 8247e63

Browse files
authored
Merge pull request #247975 from GitHubber17/141588-refresh-4
Azure OpenAI Freshness Pass - User Story: 141588
2 parents e070174 + 9e45996 commit 8247e63

9 files changed

+175
-95
lines changed
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
---
2-
title: 'How-to - Create a resource and deploy a model using Azure OpenAI Service'
2+
title: 'How-to: Create and deploy an Azure OpenAI Service resource'
33
titleSuffix: Azure OpenAI
4-
description: Walkthrough on how to get started with Azure OpenAI and make your first resource and deploy your first model.
4+
description: Learn how to get started with Azure OpenAI Service and create your first resource and deploy your first model in the Azure CLI or the Azure portal.
55
services: cognitive-services
66
manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: openai
99
ms.custom: devx-track-azurecli, build-2023, build-2023-dataai
1010
ms.topic: how-to
11-
ms.date: 02/02/2023
11+
ms.date: 08/14/2023
1212
zone_pivot_groups: openai-create-resource
1313
author: ChrisHMSFT
1414
ms.author: chrhoder
1515
recommendations: false
1616
---
1717

18-
# Create a resource and deploy a model using Azure OpenAI
18+
# Create and deploy an Azure OpenAI Service resource
1919

20-
Use this article to get started with Azure OpenAI with step-by-step instructions to create a resource and deploy a model. While the steps for resource creation and model deployment can be completed in a few minutes, the actual deployment process itself can take more than hour. You can create your resource, start your deployment, and then check back in on your deployment later rather than actively waiting for the deployment to complete.
20+
This article describes how to get started with Azure OpenAI Service and provides step-by-step instructions to create a resource and deploy a model. You can create resources in Azure in several different ways:
21+
22+
- The [Azure portal](https://portal.azure.com/?microsoft_azure_marketplace_ItemHideKey=microsoft_openai_tip#create/Microsoft.CognitiveServicesOpenAI)
23+
- The REST APIs, the Azure CLI, PowerShell, or client libraries
24+
- Azure Resource Manager (ARM) templates
25+
26+
In this article, you review examples for creating and deploying resources in the Azure portal and with the Azure CLI.
2127

2228
::: zone pivot="web-portal"
2329

24-
[!INCLUDE [Studio resource](../includes/create-resource-portal.md)]
30+
[!INCLUDE [Azure portal resource](../includes/create-resource-portal.md)]
2531

2632
::: zone-end
2733

@@ -33,5 +39,5 @@ Use this article to get started with Azure OpenAI with step-by-step instructions
3339

3440
## Next steps
3541

36-
* Now that you have a resource and your first model deployed get started making API calls and generating text with our [quickstarts](../quickstart.md).
37-
* Learn more about the [underlying models that power Azure OpenAI](../concepts/models.md).
42+
- Make API calls and generate text with [Azure OpenAI Service quickstarts](../quickstart.md).
43+
- Learn more about the [Azure OpenAI Service models](../concepts/models.md).

articles/ai-services/openai/includes/create-resource-cli.md

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,121 @@
11
---
2-
title: 'How to use the Azure CLI to create an Azure OpenAI Service resource and manage deployments'
2+
title: 'Create and manage Azure OpenAI Service deployments with the Azure CLI'
33
titleSuffix: Azure OpenAI
4-
description: Step by step guide for using the Azure CLI to deploy an Azure OpenAI Resource and manage deployments
4+
description: Learn how to use the Azure CLI to create an Azure OpenAI resource and manage deployments with the Azure OpenAI Service.
55
services: cognitive-services
66
manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: openai
99
ms.custom: devx-track-azurecli
1010
ms.topic: include
11-
ms.date: 6/30/2022
11+
ms.date: 08/14/2023
1212
keywords:
1313
---
1414

1515
## Prerequisites
1616

17-
- An Azure subscription - <a href="https://azure.microsoft.com/free/cognitive-services" target="_blank">Create one for free</a>
18-
- Access granted to Azure OpenAI in the desired Azure subscription
17+
- An Azure subscription. <a href="https://azure.microsoft.com/free/ai-services" target="_blank">Create one for free</a>.
18+
- Access granted to Azure OpenAI in the desired Azure subscription.
19+
- The Azure CLI. For more information, see [How to install the Azure CLI](/cli/azure/install-azure-cli).
1920

20-
Currently, access to this service is granted only by application. You can apply for access to the Azure OpenAI service by completing the form at <a href="https://aka.ms/oai/access" target="_blank">https://aka.ms/oai/access</a>. Open an issue on this repo to contact us if you have an issue.
21-
- Azure CLI. [Installation guide](/cli/azure/install-azure-cli)
21+
> [!NOTE]
22+
> Currently, you must submit an application to access Azure OpenAI Service. To apply for access, complete [this form](https://aka.ms/oai/access). If you need assistance, open an issue on this repository to contact Microsoft.
2223
23-
## Sign in to the CLI
24+
## Sign in to the Azure CLI
2425

25-
run the az login command to log in, `az login`
26+
[Sign in](/cli/azure/authenticate-azure-cli) to the Azure CLI or select **Open Cloudshell** in the following steps.
2627

27-
## Create a new Azure Resource Group
28-
You must have an Azure resource group in order to create an OpenAI resource. When you create a new resource, you have the option to either create a new resource group, or use an existing one. This article shows how to create a new resource group. You can create a new resource group in the Azure CLI using the `az group create` command. The example below creates a new resource group in the eastus location. you can find the full [reference documentation here](/cli/azure/group?view=azure-cli-latest&preserve-view=true#az-group-create).
28+
## Create an Azure resource group
2929

30-
```azurecli
30+
To create an Azure OpenAI resource, you need an Azure resource group. When you create a new resource through the Azure CLI, you can also create a new resource group or instruct Azure to use an existing group. The following example shows how to create a new resource group named _OAIResourceGroup_ with the [az group create](/cli/azure/group?view=azure-cli-latest&preserve-view=true#az-group-create) command. The resource group is created in the East US location.
31+
32+
```azurecli-interactive
3133
az group create \
3234
--name OAIResourceGroup \
3335
--location eastus
3436
```
3537

3638
## Create a resource
37-
Run the following command to create an OpenAI resource in the new resource group. In this example, we create a resource called MyOpenAIResource in the resource group called OAIResourceGroup. Make sure to update with your own values for the resource group, resource name and your Azure Subscription ID. You can find the full [reference documentation here](/cli/azure/cognitiveservices/account?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-create).
39+
40+
Use the [az cognitiveservices account create](/cli/azure/cognitiveservices/account?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-create) command to create an Azure OpenAI resource in the resource group. In the following example, you create a resource named _MyOpenAIResource_ in the _OAIResourceGroup_ resource group. When you try the example, update the code to use your desired values for the resource group and resource name, along with your Azure subscription ID _\<subscriptionID>_.
3841

3942
```azurecli
4043
az cognitiveservices account create \
41-
-n MyOpenAIResource \
42-
-g OAIResourceGroup \
43-
-l eastus \
44+
--name MyOpenAIResource \
45+
--resource-group OAIResourceGroup \
46+
--location eastus \
4447
--kind OpenAI \
4548
--sku s0 \
46-
--subscription 00000000-0000-0000-0000-000000000000
49+
--subscription <subscriptionID>
4750
```
4851

49-
## Retrieve information from your resource
50-
Once your resource has been created, you can use the Azure CLI to find useful information about your service such as your REST API endpoint base URL and the access keys. Below are examples on how to do both. You can find the full [reference documentation here](/cli/azure/cognitiveservices/account?view=azure-cli-latest&preserve-view=true).
51-
52-
1. **Retrieve your endpoint**:
53-
54-
```azurecli
55-
az cognitiveservices account show \
56-
-n $myResourceName \
57-
-g $myResourceGroupName \
58-
| jq -r .properties.endpoint
59-
```
60-
1. **Retrieve your primary API key**:
61-
```azurecli
62-
az cognitiveservices account keys list \
63-
-n $myResourceName \
64-
-g $myResourceGroupName
65-
| jq -r .key1
66-
```
52+
## Retrieve information about the resource
6753

68-
## Deploy a model
54+
After you create the resource, you can use different commands to find useful information about your Azure OpenAI Service instance. The following examples demonstrate how to retrieve the REST API endpoint base URL and the access keys for the new resource.
55+
56+
### Get the endpoint URL
6957

70-
To deploy a model, you can use the Azure CLI to run the following command to deploy an instance of text-curie-001. In this example, we deploy a model called MyModel. Make sure to update with your own values. You don't need to change the `model-version`, `model-format` or `scale-settings-scale-type` values. You can find the full [reference documentation here](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest&preserve-view=true).
58+
Use the [az cognitiveservices account show](/cli/azure/cognitiveservices/account?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-show) command to retrieve the REST API endpoint base URL for the resource. In this example, we direct the command output through the [jq](https://jqlang.github.io/jq/) JSON processor to locate the `.properties.endpoint` value.
7159

60+
When you try the example, update the code to use your values for the resource group _\<myResourceGroupName>_ and resource _\<myResourceName>_.
61+
62+
```azurecli
63+
az cognitiveservices account show \
64+
--name <myResourceName> \
65+
--resource-group <myResourceGroupName> \
66+
| jq -r .properties.endpoint
67+
```
68+
69+
### Get the primary API key
70+
71+
To retrieve the access keys for the resource, use the [az cognitiveservices account keys list](/cli/azure/cognitiveservices/account?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-keys-list) command. In this example, we direct the command output through the [jq](https://jqlang.github.io/jq/) JSON processor to locate the `.key1` value.
72+
73+
When you try the example, update the code to use your values for the resource group and resource.
74+
75+
```azurecli
76+
az cognitiveservices account keys list \
77+
--name <myResourceName> \
78+
--resource-group <myResourceGroupName> \
79+
| jq -r .key1
80+
```
81+
82+
## Deploy a model
83+
84+
To deploy a model, use the [az cognitiveservices account deployment create](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-deployment-create) command. In the following example, you deploy an instance of the `text-embedding-ada-002` model and give it the name _MyModel_. When you try the example, update the code to use your values for the resource group and resource. You don't need to change the `model-version`, `model-format` or `sku-capacity`, and `sku-name` values.
7285

7386
```azurecli
7487
az cognitiveservices account deployment create \
75-
-g $myResourceGroupName \
76-
-n $myResourceName \
77-
--deployment-name MyModel \
78-
--model-name text-curie-001 \
79-
--model-version "1" \
80-
--model-format OpenAI \
81-
--scale-settings-scale-type "Standard"
88+
--name <myResourceName> \
89+
--resource-group <myResourceGroupName> \
90+
--deployment-name MyModel \
91+
--model-name text-embedding-ada-002 \
92+
--model-version "1" \
93+
--model-format OpenAI \
94+
--sku-capacity "1" \
95+
--sku-name "Standard"
8296
```
8397

8498
## Delete a model from your resource
8599

86-
You can delete any model you've deployed from your resource. To do so, you can use the Azure CLI to run the following command. In this example, we delete a model called MyModel. Make sure to update with your own values. You can find the full [reference documentation here](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-deployment-delete).
100+
You can delete any model deployed from your resource with the [az cognitiveservices account deployment delete](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-deployment-delete) command. In the following example, you delete a model named _MyModel_. When you try the example, update the code to use your values for the resource group, resource, and deployed model.
87101

88102
```azurecli
89103
az cognitiveservices account deployment delete \
90-
-g $myResourceGroupName \
91-
-n $myResourceName \
92-
--deployment-name MyModel
104+
--name <myResourceName> \
105+
--resource-group <myResourceGroupName> \
106+
--deployment-name MyModel
93107
```
94108

95109
## Delete a resource
96-
If you want to clean up and remove your OpenAI resource, you can delete it or the resource group. Deleting the resource group also deletes any other resources contained in the group.
97110

98-
To remove the resource group and its associated resources, use the `az group delete` command.
111+
If you want to clean up after these exercises, you can remove your Azure OpenAI resource by deleting the resource through the Azure CLI. You can also delete the resource group. If you choose to delete the resource group, all resources contained in the group are also deleted.
99112

100-
If you're not going to continue to use this application, delete your resource with the following steps:
113+
To remove the resource group and its associated resources, use the [az cognitiveservices account delete](/cli/azure/cognitiveservices/account/deployment?view=azure-cli-latest&preserve-view=true#az-cognitiveservices-account-delete) command.
114+
115+
If you're not going to continue to use the resources created in these exercises, run the following command to delete your resource group. Be sure to update the example code to use your values for the resource group and resource.
101116

102117
```azurecli
103118
az cognitiveservices account delete \
104-
--name MyOpenAIResource \
105-
-g OAIResourceGroup
119+
--name <myResourceName> \
120+
--resource-group <myResourceGroupName>
106121
```
107-

0 commit comments

Comments
 (0)