Quickstart: Create a Cognitive Services resource using an ARM template

This quickstart describes how to use an Azure Resource Manager template (ARM template) to create Cognitive Services.

Azure Cognitive Services are cloud-based artificial intelligence (AI) services that help developers build cognitive intelligence into applications without having direct AI or data science skills or knowledge. They are available through REST APIs and client library SDKs in popular development languages. Azure Cognitive Services enables developers to easily add cognitive features into their applications with cognitive solutions that can see, hear, speak, and analyze.

Create a resource using an Azure Resource Manager template (ARM template). This multi-service resource lets you:

  • Access multiple Azure Cognitive Services with a single key and endpoint.
  • Consolidate billing from the services you use.
  • You must create your first Face, Language service, or Computer Vision resources from the Azure portal to review and acknowledge the terms and conditions. You can do so here: Face, Language service, Computer Vision. After that, you can create subsequent resources using any deployment tool (SDK, CLI, or ARM template, etc) under the same Azure subscription.

A resource manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. In declarative syntax, you describe your intended deployment without writing the sequence of programming commands to create the deployment.

Prerequisites

Review the template

The template used 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.8.9.13224",
      "templateHash": "13077289615008073304"
    }
  },
  "parameters": {
    "cognitiveServiceName": {
      "type": "string",
      "defaultValue": "[format('CognitiveService-{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": "2021-10-01",
      "name": "[parameters('cognitiveServiceName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('sku')]"
      },
      "kind": "CognitiveServices",
      "properties": {
        "apiProperties": {
          "statisticsEnabled": false
        }
      }
    }
  ]
}

One Azure resource is defined in the Bicep file: Microsoft.CognitiveServices/accounts specifies that it is a Cognitive Services resource. The kind field in the Bicep file defines the type of resource.

See the list of SKUs and pricing information below.

Multi-service

Service Kind
Multiple services. For more information, see the pricing page. CognitiveServices

Vision

Service Kind
Computer Vision ComputerVision
Custom Vision - Prediction CustomVision.Prediction
Custom Vision - Training CustomVision.Training
Face Face
Form Recognizer FormRecognizer

Speech

Service Kind
Speech Services SpeechServices

Language

Service Kind
LUIS LUIS
QnA Maker QnAMaker
Language service TextAnalytics
Text Translation TextTranslation

Decision

Service Kind
Anomaly Detector AnomalyDetector
Content Moderator ContentModerator
Personalizer Personalizer

Pricing tiers and billing

Pricing tiers (and the amount you get billed) are based on the number of transactions you send using your authentication information. Each pricing tier specifies the:

  • maximum number of allowed transactions per second (TPS).
  • service features enabled within the pricing tier.
  • cost for a predefined number of transactions. Going above this number will cause an extra charge as specified in the pricing details for your service.

Note

Many of the Cognitive Services have a free tier you can use to try the service. To use the free tier, use F0 as the SKU for your resource.

Deploy the template

  1. Click the Deploy to Azure button.

    Deploy 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 click OK.
    Region Select a region. For example, East US
    Cognitive Service Name Replace with a unique name for your resource. You will need the name in the next section when you validate the deployment.
    Location Replace with the region used above.
    Sku The pricing tier for your resource.

    Resource creation screen.

  3. Select Review + Create, then Create. After the resource has successfully finished deploying, the Go to resource button will be highlighted.

Tip

If your subscription doesn't allow you to create a Cognitive Service resource, you may need to enable the privilege of that Azure resource provider using the Azure portal, PowerShell command or an Azure CLI command. If you are not the subscription owner, ask the Subscription Owner or someone with a role of admin 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 will be able to click 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 navigation menu.
  2. Selecting the resource group name.

Clean up resources

If you want to clean up and remove a Cognitive Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources contained in the group.

  1. In the Azure portal, expand the menu on the left side to open the menu of services, and choose Resource Groups to display the list of your resource groups.
  2. Locate the resource group containing the resource to be deleted
  3. Right-click on the resource group listing. Select Delete resource group, and confirm.

If you need to recover a deleted resource, see Recover deleted Cognitive Services resources.

See also