Azure Cognitive Services Account

This page shows how to write Terraform and Azure Resource Manager for Cognitive Services Account and write them securely.

azurerm_cognitive_account (Terraform)

The Account in Cognitive Services can be configured in Terraform with the resource name azurerm_cognitive_account. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L32
resource "azurerm_cognitive_account" "az-speech-cog" {
  name                = format("cog-%s-speech-prod-001", var.name)
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  kind                = "SpeechServices"
  // If you already have a S0 service configured you'll need to set this to S1
main.tf#L9
resource "azurerm_cognitive_account" "speech" {
    name                = var.custom_speech_account_name
    location            = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name
    kind                = "SpeechServices"
    sku_name            = var.custom_speech_account_sku
azure-customvision.tf#L6
resource "azurerm_cognitive_account" "vision" {
    name                = "iot-vision"
    location            = azurerm_resource_group.iot.location
    resource_group_name = azurerm_resource_group.iot.name
    kind                = "CustomVision.Training"

main.tf#L4
resource "azurerm_cognitive_account" "translation" {
  kind = "TextTranslation"
  location = var.az_location
  name = var.name
  resource_group_name = var.resource_group_name
  sku_name = "S1"
main.tf#L1
resource "azurerm_cognitive_account" "computervision" {
  name                = var.vision
  location            = var.location
  resource_group_name = var.resource_group_name
  kind                = var.api_kind

computervision.tf#L1
resource "azurerm_cognitive_account" "computervision" {
  name                = "computer-vision-ocr"
  location            = azurerm_resource_group.main.location
  resource_group_name = azurerm_resource_group.main.name
  kind                = "ComputerVision"
  sku_name = "S1"
main.tf#L1
resource "azurerm_cognitive_account" "computervision" {
  name                = var.vision
  location            = var.location
  resource_group_name = var.resource_group_name
  kind                = var.api_kind

main.tf#L1
resource "azurerm_cognitive_account" "example" {
  name                = "example-account"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  kind                = "Face"

azure-customvision.tf#L6
resource "azurerm_cognitive_account" "vision" {
    name                = "iot-vision"
    location            = azurerm_resource_group.iot.location
    resource_group_name = azurerm_resource_group.iot.name
    kind                = "CustomVision.Training"

cognitive-account.tf#L2
resource "azurerm_cognitive_account" "cognitive_account" {
  name                = var.name
  location            = var.location
  resource_group_name = var.resource_group_name
  kind                = var.kind
  sku_name = var.cs_sku_name

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Cognitive Services Account. -> Note: Version v2.65.0 of the Azure Provider and later will attempt to Purge the Cognitive Account during deletion. This feature can be disabled using the features block within the provider block, see the provider documentation on the features block for more information.

Microsoft.CognitiveServices/accounts (Azure Resource Manager)

The accounts in Microsoft.CognitiveServices can be configured in Azure Resource Manager with the resource name Microsoft.CognitiveServices/accounts. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

template.json
{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",
template.json
{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",
dash.json
{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",
template.json
{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",

Parameters

  • apiVersion required - string
  • identity optional
      • type optional - string

        The identity type.

      • userAssignedIdentities optional - undefined

        The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}

  • kind optional - string

    The kind (type) of cognitive service account.

  • location optional - string

    The geo-location where the resource lives

  • name required - string

    The name of Cognitive Services account.

  • properties required
      • allowedFqdnList optional - array
      • apiProperties optional
          • aadClientId optional - string

            (Metrics Advisor Only) The Azure AD Client Id (Application Id).

          • aadTenantId optional - string

            (Metrics Advisor Only) The Azure AD Tenant Id.

          • additionalProperties optional - object

            Unmatched properties from the message are deserialized this collection

          • eventHubConnectionString optional - string

            (Personalization Only) The flag to enable statistics of Bing Search.

          • qnaAzureSearchEndpointId optional - string

            (QnAMaker Only) The Azure Search endpoint id of QnAMaker.

          • qnaAzureSearchEndpointKey optional - string

            (QnAMaker Only) The Azure Search endpoint key of QnAMaker.

          • qnaRuntimeEndpoint optional - string

            (QnAMaker Only) The runtime endpoint of QnAMaker.

          • statisticsEnabled optional - boolean

            (Bing Search Only) The flag to enable statistics of Bing Search.

          • storageAccountConnectionString optional - string

            (Personalization Only) The storage account connection string.

          • superUser optional - string

            (Metrics Advisor Only) The super user of Metrics Advisor.

          • websiteName optional - string

            (Metrics Advisor Only) The website name of Metrics Advisor.

      • customSubDomainName optional - string

        Optional subdomain name used for token-based authentication.

      • disableLocalAuth optional - boolean
      • encryption optional
          • keySource optional - string

            Enumerates the possible value of keySource for Encryption.

          • keyVaultProperties optional
              • identityClientId optional - string
              • keyName optional - string

                Name of the Key from KeyVault

              • keyVaultUri optional - string

                Uri of KeyVault

              • keyVersion optional - string

                Version of the Key from KeyVault

      • migrationToken optional - string

        Resource migration token.

      • networkAcls optional
          • defaultAction optional - string

            The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.

          • ipRules optional array
              • value required - string

                An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78).

          • virtualNetworkRules optional array
              • id required - string

                Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.

              • ignoreMissingVnetServiceEndpoint optional - boolean

                Ignore missing vnet service endpoint or not.

              • state optional - string

                Gets the state of virtual network rule.

      • publicNetworkAccess optional - string

        Whether or not public endpoint access is allowed for this account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'.

      • restore optional - boolean
      • restrictOutboundNetworkAccess optional - boolean
      • userOwnedStorage optional array
          • identityClientId optional - string
          • resourceId optional - string

            Full resource id of a Microsoft.Storage resource.

  • sku optional
      • capacity optional - integer

        If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted.

      • family optional - string

        If the service has different generations of hardware, for the same SKU, then that can be captured here.

      • name required - string

        The name of the SKU. Ex - P3. It is typically a letter+number code

      • size optional - string

        The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.

      • tier optional - string

        This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.

  • tags optional - string

    Resource tags.

  • type required - string

Frequently asked questions

What is Azure Cognitive Services Account?

Azure Cognitive Services Account is a resource for Cognitive Services of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Cognitive Services Account?

For Terraform, the errbufferoverfl/pearl-memory, jwendl/custom-commands-terraform-provider and Abisaha/Kubernetes_sock source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the scautomation/Azure-Inventory-Workbook, VJchand-star/Azure and rb-cloud-guru/Azure_Dashboard source code examples are useful. See the Azure Resource Manager Example section for further details.