Quickstart: Create a Cognitive Services resource using Bicep

Follow this quickstart to create Cognitive Services resource using Bicep.

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.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.

Things to consider

Using Bicep to create a Cognitive Service resource lets you create a multi-service resource. This enables you to:

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


Review the Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.


  • If you use a different resource kind (listed below), you may need to change the sku parameter to match the pricing tier you wish to use. For example, the TextAnalytics kind uses S instead of S0.
  • Many of the Cognitive Services have a free F0 pricing tier that you can use to try the service.

Be sure to change the sku parameter to the pricing instance you want. The sku depends on the resource kind that you are using. For example, TextAnalytics

@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>)')
param cognitiveServiceName string = 'CognitiveService-${uniqueString(resourceGroup().id)}'

@description('Location for all resources.')
param location string = resourceGroup().location

param sku string = 'S0'

resource cognitiveService 'Microsoft.CognitiveServices/accounts@2021-10-01' = {
  name: cognitiveServiceName
  location: location
  sku: {
    name: 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.


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


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


Service Kind
Speech Services SpeechServices


Service Kind
QnA Maker QnAMaker
Language service TextAnalytics
Text Translation TextTranslation


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.


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 Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep

    When the deployment finishes, you should see a message indicating the deployment succeeded.

Review deployed resources

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group exampleRG

Clean up resources

When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.

az group delete --name exampleRG

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

See also