Create a resource and deploy a model using Azure OpenAI
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.
Prerequisites
An Azure subscription - Create one for free
Access granted to Azure OpenAI in the desired Azure subscription
Currently, access to this service is granted only by application. You can apply for access to Azure OpenAI by completing the form at https://aka.ms/oai/access. Open an issue on this repo to contact us if you have an issue.
Create a resource
Resources in Azure can be created several different ways:
- Within the Azure portal
- Using the REST APIs, Azure CLI, PowerShell or client libraries
- Via ARM templates
This guide walks you through the Azure portal creation experience.
Navigate to the create page: Azure OpenAI Service Create Page
On the Create page provide the following information:
Field Description Subscription Select the Azure subscription used in your OpenAI onboarding application Resource group The Azure resource group that will contain your OpenAI resource. You can create a new group or add it to a pre-existing group. Region The location of your instance. Different locations may introduce latency, but have no impact on the runtime availability of your resource. Name A descriptive name for your cognitive services resource. For example, MyOpenAIResource. Pricing Tier Only 1 pricing tier is available for the service currently
Deploy a model
Before you can generate text or inference, you need to deploy a model. You can select from one of several available models in Azure OpenAI Studio.
Davinci is the most capable model family and can perform any task the other models can perform and often with less instruction. For applications requiring a lot of understanding of the content, like summarization for a specific audience and creative content generation, Davinci is going to produce the best results.
To deploy a model, follow these steps:
Sign in to Azure OpenAI Studio.
Select the subscription and OpenAI resource to work with.
Select Manage deployments in your resource > Go to Deployments under Manage your deployments and models. You might first need to scroll down on the landing page.
Select Create new deployment from the Management > Deployments page.
Select a model from the drop-down. For getting started in the East US region, we recommend the
text-davinci-003
model. In other regions you should start with thetext-davinci-002
model. Some models are not available in all regions. For a list of available models per region, see Model Summary table and region availability.Enter a model name to help you identify the model. Choose a name carefully. The model name will be used as the deployment name via OpenAI client libraries and API.
Select Create to deploy the model.
The deployments table displays a new entry that corresponds to this newly created model. Your deployment status will move to succeeded when the deployment is complete and ready for use.
Prerequisites
An Azure subscription - Create one for free
Access granted to Azure OpenAI in the desired Azure subscription
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 https://aka.ms/oai/access. Open an issue on this repo to contact us if you have an issue.
Azure CLI. Installation guide
Sign in to the CLI
run the az login command to log in, az login
Create a new Azure Resource Group
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.
az group create \
--name OAIResourceGroup\
--location eastus
Create a resource
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.
az cognitiveservices account create \
-n MyOpenAIResource \
-g OAIResourceGroup \
-l eastus \
--kind OpenAI \
--sku s0 \
--subscription 00000000-0000-0000-0000-000000000000
Retrieve information from your resource
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.
Retrieve your endpoint:
az cognitiveservices account show \ -n $myResourceName \ -g $myResourceGroupName \ | jq -r .properties.endpoint
Retrieve your primary API key:
az cognitiveservices account keys list \ -n $myResourceName \ -g $myResourceGroupName | jq -r .key1
Deploy a model
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.
az cognitiveservices account deployment create \
-g $myResourceGroupName \
-n $myResourceName \
--deployment-name MyModel \
--model-name text-curie-001 \
--model-version "1" \
--model-format OpenAI \
--scale-settings-scale-type "Standard"
Delete a model from your resource
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.
az cognitiveservices account deployment delete \
-g $myResourceGroupName \
-n $myResourceName \
--deployment-name MyModel
Delete a resource
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.
To remove the resource group and its associated resources, use the az group delete
command.
If you're not going to continue to use this application, delete your resource with the following steps:
az cognitiveservices account delete \
--name MyOpenAIResource \
-g OAIResourceGroup
Next steps
- Now that you have a resource and your first model deployed get started making API calls and generating text with our quickstarts.
- Learn more about the underlying models that power Azure OpenAI.
Feedback
Submit and view feedback for