Deploy DALL-E Resource and Model with Azure CLI

This Microsoft Azure OpenAI post will show you how to deploy a DALL-E resource and model using Azure CLI.

Azure OpenAI is an OpenAI implementation inside Microsoft Azure and allows customers to use OpenAI within the Azure cloud infrastructure.

The upside of using the Azure OpenAI service is that it allows organizations to use their existing investment in Azure and add AI capabilities using a single infrastructure.

DALL-E

The OpenAI DALL-E AI model allows us to generate images in a high-definition format using text prompts. We simply ask the model in natural language to create an image, and it returns a URL with the generated image.

Generated images are available to download immediately and for 60 minutes from the generated URL. After 60 minutes, the image is deleted from the Azure OpenAI.

We can access the DALL-E 3 AI model from the following Azure regions.

  • EastUS
  • AustraliaEast
  • SwedenCentral

Deploy DALL-E Resource and Model with Azure CLI

Before we can access the DALL-E service, we must create the following. Azure OpenAI resource that is available via the Azure Portal. Azure OpenAI deployment with an AI model.

This is a two-way process: first, we create an Azure resource and then attach a deployment that contains an AI model.

For this deployment to work, make sure you have Azure CLI installed on your machine if you need to install Azure CLI, visit this link.

Azure CLI Code

The following Azure CLI code will create DALL-E deployment and Azure OpenAI resource in SwedenCentral.


# Define variables
RG_NAME="rg-apress-ch6"
LOC="SwedenCentral"
AI_ACCOUNT_NAME="aoi-apress-ai"
AI_KIND="OpenAI"
AI_SKU="S0"
DEPLOY_NAME="dall-e-3"
MODEL_ID="dall-e-3"
MODEL_TYPE="OpenAI"
MODEL_VER="3.0"
DEPLOY_SKU_NAME="Standard"
DEPLOY_SKU_CAPACITY="1"

# Create an Azure resource group
az group create --name $RG_NAME --location $LOC

# Create an Azure OpenAI resource
az cognitiveservices account create --name $AI_ACCOUNT_NAME --location $LOC --resource-group $RG_NAME --kind $AI_KIND --sku $AI_SKU

# Create an Azure OpenAI deployment
az cognitiveservices account deployment create --name $AI_ACCOUNT_NAME --resource-group $RG_NAME --deployment-name $DEPLOY_NAME --model-name $MODEL_ID --model-format $MODEL_TYPE --model-version $MODEL_VER --sku-name $DEPLOY_SKU_NAME --sku-capacity $DEPLOY_SKU_CAPACITY

3 thoughts on “Deploy DALL-E Resource and Model with Azure CLI”

Leave a Comment