This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

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 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. A descriptive name for your Azure AI 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.

    To deploy a model, follow these steps:

  • Sign in to Azure OpenAI Studio .

  • Select the subscription and Azure OpenAI resource to work with.

  • Under Management select Deployments .

  • Select Create new deployment .

    Field Description Select a model Model availability varies by region.For a list of available models per region, see Model Summary table and region availability . Deployment name Choose a name carefully. The deployment name will be used in your code to call the model via the client libraries and REST API Advanced Options Content Filter - Assign a content filter to your deployment.
    Tokens per Minute Rate Limit - Adjust the Tokens per Minute (TPM) to set the effective rate limit for your deployment. You can modify this value at any time via the Quotas menu
  • Select a model from the drop-down.

  • Enter a deployment name to help you identify the model.

  • For your first deployment leave the Advanced Options set to the defaults.

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