Quickstart - Create an Azure AI services resource by using an ARM template

This quickstart shows you how to use an Azure Resource Manager template (ARM template) to create a resource in Azure AI services.

Azure AI services help developers and organizations rapidly create intelligent, cutting-edge, market-ready, and responsible applications with out-of-the-box and prebuilt and customizable APIs and models. Example applications include natural language processing for conversations, search, monitoring, translation, speech, vision, and decision-making.

Most Azure AI services are available through REST APIs and client library SDKs in popular development languages. For more information, see each service's documentation.

An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. You describe your intended deployment without writing the sequence of programming commands to create the deployment.

Prerequisites

Review the template

The template that you use in this quickstart is from Azure Quickstart Templates.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.29.47.4906",
      "templateHash": "6912458133303539897"
    }
  },
  "parameters": {
    "aiServicesName": {
      "type": "string",
      "defaultValue": "[format('aiServices-{0}', uniqueString(resourceGroup().id))]",
      "metadata": {
        "description": "That name is the name of our application. It has to be unique.Type a name followed by your resource group name. (<name>-<resourceGroupName>)"
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    },
    "sku": {
      "type": "string",
      "defaultValue": "S0",
      "allowedValues": [
        "S0"
      ]
    }
  },
  "resources": [
    {
      "type": "Microsoft.CognitiveServices/accounts",
      "apiVersion": "2023-05-01",
      "name": "[parameters('aiServicesName')]",
      "location": "[parameters('location')]",
      "identity": {
        "type": "SystemAssigned"
      },
      "sku": {
        "name": "[parameters('sku')]"
      },
      "kind": "AIServices",
      "properties": {
        "publicNetworkAccess": "Disabled",
        "networkAcls": {
          "defaultAction": "Deny"
        },
        "disableLocalAuth": true
      }
    }
  ]
}

One Azure resource is defined in the Bicep file. The kind field in the Bicep file defines the type of resource.

As needed, change the sku parameter value to the pricing instance you want. The sku depends on the resource kind that you use. For example, use TextAnalytics for the Azure AI Language service. The TextAnalytics kind uses S instead of S0 for the sku value.

Deploy the template

  1. Select the Deploy to Azure button.

    Button to deploy the Resource Manager template to Azure.

  2. Enter the following values.

    Value Description
    Subscription Select an Azure subscription.
    Resource group Select Create new, enter a unique name for the resource group, and then select OK.
    Region Select a region (for example, China East 2).
    AI service Name Replace the value with a unique name for your Azure AI services resource. You'll need the name in the next section when you validate the deployment.
    Location Replace with the region that you selected.
    Sku Select the pricing tier for your resource.

    Screenshot that shows the pane for resource creation.

  3. Select Review + Create, and then select Create. When deployment is successful, the Go to resource button is available.

Tip

If your subscription doesn't allow you to create an Azure AI services resource, you might need to enable the privilege of that Azure resource provider by using the Azure portal, a PowerShell command or an Azure CLI command. If you're not the subscription owner, ask the subscription owner or someone with an admin role to complete the registration for you. Or ask for the /register/action privileges to be granted to your account.

Review deployed resources

When your deployment finishes, you can select the Go to resource button to see your new resource. You can also find the resource group by:

  1. Selecting Resource groups from the left pane.
  2. Selecting the resource group name.

Clean up resources

If you want to clean up and remove an Azure AI services subscription, you can delete the resource or the resource group. Deleting the resource group also deletes any other resources that the group contains.

  1. On the left pane, select Resource groups to display the list of your resource groups.
  2. Locate the resource group that contains the resource to be deleted.
  3. Right-click the resource group, select Delete resource group, and then confirm.